home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
mint
/
lib
/
mlib42d.zoo
/
diffc
< prev
next >
Wrap
Text File
|
1994-01-16
|
104KB
|
3,880 lines
*** 41.1 1993/11/03 13:33:02
--- abs.c 1993/11/24 20:22:04
***************
*** 1,6 ****
--- 1,13 ----
/* return absolute values */
#include <stdlib.h>
+ #ifdef abs
+ #undef abs
+ #endif
+ #ifdef labs
+ #undef labs
+ #endif
+
int abs(x)
int x;
{ return x < 0 ? -x : x; }
*** 41.1 1993/11/03 13:33:02
--- bblink.c 1994/01/13 08:03:30
***************
*** 5,38 ****
#include <compiler.h>
#include <stdio.h>
#include <stdlib.h>
! /* block count struct produced by gcc -tcov */
! typedef struct _bb_count {
long initialized; /* has __bb_init_func been called */
! char *filename; /* filename for .d file */
! long *block_counts; /* address of block count table */
! long ncount; /* sizeof block count table */
/* ie: # of basic blocks in file */
! struct _bb_count *next; /* in memory link to next struct */
! char ***addr_table; /* addr of basic block address table */
! /* size of addr_table == ncount+1 */
! } BB_COUNT;
! void __bb_init_func __PROTO((BB_COUNT *));
static void exit_func __PROTO((void)); /* installed to be called at exit */
! static void save_info __PROTO((BB_COUNT *));
/* vars */
! static BB_COUNT *hdr = NULL; /* list of all bb_count for which
__bb_init_func has been called */
static char first_call = 1; /* flags first call to __bb_init_func */
static char at_exit_failed = 0; /* flag to indicate that atexit() failed */
/*
! * called by gcc -tcov generated code on first entry into a function
*/
void __bb_init_func(bb_count)
! BB_COUNT *bb_count;
{
if(at_exit_failed)
return;
--- 5,48 ----
#include <compiler.h>
#include <stdio.h>
#include <stdlib.h>
+ #include <time.h>
+ #include <string.h>
! /* block count struct produced by gcc -a */
! struct bb {
long initialized; /* has __bb_init_func been called */
! const char *filename; /* filename for .d file */
! long *counts; /* address of block count table */
! long ncounts; /* sizeof block count table */
/* ie: # of basic blocks in file */
! struct bb *next; /* in memory link to next struct */
! const unsigned long *addresses; /* addr of basic block address table */
! /* size of address table == ncounts+1 */
!
! /* Older GCC's did not emit these fields. */
! long nwords;
! const char **functions;
! const long *line_nums;
! const char **filenames;
! };
! void __bb_init_func __PROTO((struct bb *));
static void exit_func __PROTO((void)); /* installed to be called at exit */
! #ifdef OLD
! static void save_info __PROTO((struct bb *));
! #endif
/* vars */
! static struct bb *bb_head = NULL; /* list of all bb_count for which
__bb_init_func has been called */
static char first_call = 1; /* flags first call to __bb_init_func */
static char at_exit_failed = 0; /* flag to indicate that atexit() failed */
/*
! * called by gcc -a generated code on first entry into a function
*/
void __bb_init_func(bb_count)
! struct bb *bb_count;
{
if(at_exit_failed)
return;
***************
*** 51,71 ****
if(bb_count->initialized == 0)
{ /* link into list of bb_counts */
! bb_count->next = hdr;
! hdr = bb_count;
bb_count->initialized = 1;
}
}
/*
* called on normal exit
* write out block profile files for each bb_count struct in list.
*/
static void exit_func()
{
! BB_COUNT *p;
! for(p = hdr; p; p = p->next)
save_info(p);
}
--- 61,82 ----
if(bb_count->initialized == 0)
{ /* link into list of bb_counts */
! bb_count->next = bb_head;
! bb_head = bb_count;
bb_count->initialized = 1;
}
}
+ #ifdef OLD
/*
* called on normal exit
* write out block profile files for each bb_count struct in list.
*/
static void exit_func()
{
! struct bb *p;
! for(p = bb_head; p; p = p->next)
save_info(p);
}
***************
*** 78,88 ****
* given a bb_count struct, save info into .d file
*/
static void save_info(p)
! BB_COUNT *p;
{
FILE *fp;
long i, *bcounts;
! DINFO *dinfo = malloc(p->ncount * sizeof(DINFO));
if(!dinfo)
{
--- 89,99 ----
* given a bb_count struct, save info into .d file
*/
static void save_info(p)
! struct bb *p;
{
FILE *fp;
long i, *bcounts;
! DINFO *dinfo = malloc(p->ncounts * sizeof(DINFO));
if(!dinfo)
{
***************
*** 97,118 ****
return;
}
/* read .d file & accumulate counts */
! for(i = 0, bcounts = p->block_counts;
fscanf(fp, "%ld%ld", &dinfo[i].lineno, &dinfo[i].count) == 2; i++)
{
! if(i >= p->ncount)
{
fprintf(stderr, "Block counts in %s exceed expected %ld, rest skipped\n",
! p->filename, p->ncount);
break;
}
dinfo[i].count += bcounts[i];
}
fclose(fp);
! if(i < p->ncount)
{
fprintf(stderr, "Warning Block counts in %s less than expected %ld\n",
! p->filename, p->ncount);
}
if((fp = fopen(p->filename, "w")) == NULL)
{
--- 108,129 ----
return;
}
/* read .d file & accumulate counts */
! for(i = 0, bcounts = p->counts;
fscanf(fp, "%ld%ld", &dinfo[i].lineno, &dinfo[i].count) == 2; i++)
{
! if(i >= p->ncounts)
{
fprintf(stderr, "Block counts in %s exceed expected %ld, rest skipped\n",
! p->filename, p->ncounts);
break;
}
dinfo[i].count += bcounts[i];
}
fclose(fp);
! if(i < p->ncounts)
{
fprintf(stderr, "Warning Block counts in %s less than expected %ld\n",
! p->filename, p->ncounts);
}
if((fp = fopen(p->filename, "w")) == NULL)
{
***************
*** 120,126 ****
free(dinfo);
return;
}
! for(i = 0; i < p->ncount; i++)
{
if(fprintf(fp, "\t%ld\t%ld\n", dinfo[i].lineno, dinfo[i].count) == EOF)
{
--- 131,137 ----
free(dinfo);
return;
}
! for(i = 0; i < p->ncounts; i++)
{
if(fprintf(fp, "\t%ld\t%ld\n", dinfo[i].lineno, dinfo[i].count) == EOF)
{
***************
*** 133,135 ****
--- 144,275 ----
fclose(fp);
free(dinfo);
}
+
+ #else /* !OLD */
+
+ /* from GCC's libgcc2.c */
+
+ /* Return the number of digits needed to print a value */
+ /* __inline__ */ static int num_digits (long value, int base)
+ {
+ int minus = (value < 0 && base != 16);
+ unsigned long v = (minus) ? -value : value;
+ int ret = minus;
+
+ do
+ {
+ v /= base;
+ ret++;
+ }
+ while (v);
+
+ return ret;
+ }
+
+ static void
+ exit_func (void)
+ {
+ FILE *file = fopen ("bb.out", "a");
+ time_t time_value;
+
+ if (!file)
+ perror ("bb.out");
+
+ else
+ {
+ struct bb *ptr;
+
+ time (&time_value);
+ fprintf (file, "Basic block profiling finished on %s\n", ctime (&time_value));
+
+ /* We check the length field explicitly in order to allow compatibility
+ with older GCC's which did not provide it. */
+
+ for (ptr = bb_head; ptr != (struct bb *) NULL; ptr = ptr->next)
+ {
+ int i;
+ int func_p = (ptr->nwords >= sizeof (struct bb) && ptr->nwords <= 1000);
+ int line_p = (func_p && ptr->line_nums);
+ int file_p = (func_p && ptr->filenames);
+ long ncounts = ptr->ncounts;
+ long cnt_max = 0;
+ long line_max = 0;
+ long addr_max = 0;
+ int file_len = 0;
+ int func_len = 0;
+ int blk_len = num_digits (ncounts, 10);
+ int cnt_len;
+ int line_len;
+ int addr_len;
+
+ fprintf (file, "File %s, %ld basic blocks \n\n",
+ ptr->filename, ncounts);
+
+ /* Get max values for each field. */
+ for (i = 0; i < ncounts; i++)
+ {
+ const char *p;
+ int len;
+
+ if (cnt_max < ptr->counts[i])
+ cnt_max = ptr->counts[i];
+
+ if (addr_max < ptr->addresses[i])
+ addr_max = ptr->addresses[i];
+
+ if (line_p && line_max < ptr->line_nums[i])
+ line_max = ptr->line_nums[i];
+
+ if (func_p)
+ {
+ p = (ptr->functions[i]) ? (ptr->functions[i]) : "<none>";
+ len = strlen (p);
+ if (func_len < len)
+ func_len = len;
+ }
+
+ if (file_p)
+ {
+ p = (ptr->filenames[i]) ? (ptr->filenames[i]) : "<none>";
+ len = strlen (p);
+ if (file_len < len)
+ file_len = len;
+ }
+ }
+
+ addr_len = num_digits (addr_max, 16);
+ cnt_len = num_digits (cnt_max, 10);
+ line_len = num_digits (line_max, 10);
+
+ /* Now print out the basic block information. */
+ for (i = 0; i < ncounts; i++)
+ {
+ fprintf (file,
+ " Block #%*d: executed %*ld time(s) address= 0x%.*lx",
+ blk_len, i+1,
+ cnt_len, ptr->counts[i],
+ addr_len, ptr->addresses[i]);
+
+ if (func_p)
+ fprintf (file, " function= %-*s", func_len,
+ (ptr->functions[i]) ? ptr->functions[i] : "<none>");
+
+ if (line_p)
+ fprintf (file, " line= %*ld", line_len, ptr->line_nums[i]);
+
+ if (file_p)
+ fprintf (file, " file= %s",
+ (ptr->filenames[i]) ? ptr->filenames[i] : "<none>");
+
+ fprintf (file, "\n");
+ }
+
+ fprintf (file, "\n");
+ fflush (file);
+ }
+
+ fprintf (file, "\n\n");
+ fclose (file);
+ }
+ }
+ #endif /* OLD */
*** /dev/null Sun Jan 16 03:52:52 1994
--- buffindf.c Sun Jan 9 04:37:54 1994
***************
*** 0 ****
--- 1,129 ----
+ /* _buffindfile: given a base filename, a list of directories, and a list
+ of possible extensions to the filename, attempts to find a file.
+ Useful for doing, e.g. spawnvp. Note that the current directory
+ is always searched first! If the filename already contains a
+ path specification (or extension) then the given path list
+ (or extension list) is ignored.
+ Returns the name by which the file was found, or NULL.
+
+ Written by Eric R. Smith and placed in the public domain.
+
+ rehacked by Uwe Ohse, 28.4.93, to support reentrant spawn/popen.
+
+ 19.12.93, Andreas Schwab, clean up namespace:
+ - findfile moved to separate file
+ - buffindfile renamed to _buffindfile
+ */
+
+ #include <compiler.h>
+ #include <support.h>
+ #include <stddef.h>
+ #include <types.h>
+ #include <stat.h>
+ #include <string.h>
+
+ /* characters used to separate components in a path list */
+ #define PATHSEP1 ':'
+ #define PATHSEP2 ','
+
+ /* characters used to separate directory names in a file */
+ #define DIRSEP1 '\\' /* native OS directory separator */
+ #define DIRSEP2 '/' /* for emulating another OS */
+
+ static char *const nullext[] = { NULL };
+
+ static int EXISTS __PROTO((const char *));
+
+ static int
+ EXISTS(name)
+ const char *name;
+ {
+ struct stat dummy;
+
+ if (stat(name, &dummy) != 0)
+ return 0;
+ if ( (dummy.st_mode & S_IFMT) != S_IFREG )
+ return 0;
+ return 1;
+ }
+
+
+ char *
+ _buffindfile(fname, fpath, fext, try)
+ const char *fname, *fpath;
+ char *const *fext, *try;
+ {
+ char *s, *extplace, *const *nextext, c;
+ const char *t;
+ int hasext = 0, haspath = 0;
+
+ if (!fname || !*fname)
+ return NULL;
+
+ s = try; t = fname;
+
+ /* copy the file in, checking to see if a path and/or extension are already
+ given */
+
+ while ( (c = *t++) != 0 )
+ {
+ if (c == DIRSEP1 || c == DIRSEP2)
+ {
+ haspath = 1;
+ hasext = 0;
+ }
+ else if (c == '.')
+ hasext = 1;
+ *s++ = c;
+ }
+ extplace = s;
+ *s = 0;
+
+ if (haspath || !fpath)
+ fpath = "";
+ if (hasext || !fext)
+ fext = nullext;
+
+ for(;;) { /* loop on path elements */
+ nextext = fext;
+ if (!hasext) {
+ extplace[0] = 0;
+ extplace[1] = 0;
+ }
+
+ if (EXISTS(try))
+ return try;
+ extplace[0] = '.';
+ while(*nextext) { /* loop on extensions */
+ (void)strcpy(&extplace[1], *nextext++);
+ if (EXISTS(try))
+ return try;
+ }
+ if (!*fpath) break; /* no more places to look */
+
+ /* copy in next element of path list */
+ s = try;
+ /* an attempt to accomodate within reason TOS specs -- mj */
+ if (*(fpath + 1) == ':') {
+ if ((*(fpath + 2) == DIRSEP1 ||
+ *(fpath + 2) == DIRSEP2) &&
+ (*fpath != '.' && *fpath != ':')) {
+ *s++ = *fpath++;
+ *s++ = *fpath++;
+ *s++ = *fpath++;
+ }
+ }
+ while ((c = *fpath) != 0 && c != PATHSEP1 && c != PATHSEP2) {
+ *s++ = c;
+ fpath++;
+ }
+ if (c)
+ fpath++;
+ *s++ = DIRSEP1;
+ t = fname;
+ while ((*s++ = *t++) != 0)
+ ;
+ extplace = --s ; /* where the extension gets written */
+ }
+ return NULL;
+ }
*** 41.1 1993/11/03 13:33:02
--- bzero.cpp 1993/12/01 20:44:42
***************
*** 29,35 ****
--- 29,37 ----
movl sp@(12),d1 | length
#endif
jeq exit | length==0? (size_t)
+ #ifdef Lbzero
jra do_set
+ #endif
#endif /* Lmemset */
#ifdef Lbzero
*** 41.1 1993/11/03 13:33:02
--- fdopen.c 1994/01/13 09:37:10
***************
*** 5,10 ****
--- 5,12 ----
#include <unistd.h>
#include <errno.h>
+ extern int __mint;
+
FILE *fdopen(h, mode)
register int h;
register const char *mode;
***************
*** 59,65 ****
iomode |= O_RDWR;
if(isatty(h))
! f |= (_IODEV | _IONBF);
else
f |= _IOFBF;
fp->_file = h; /* file handle */
--- 61,67 ----
iomode |= O_RDWR;
if(isatty(h))
! f |= __mint ? (_IODEV | _IONBF | _IOBIN) : (_IODEV | _IONBF);
else
f |= _IOFBF;
fp->_file = h; /* file handle */
*** 41.1 1993/11/03 13:33:02
--- findfile.c 1994/01/13 13:01:34
***************
*** 1,137 ****
- /* findfile: given a base filename, a list of directories, and a list
- of possible extensions to the filename, attempts to find a file.
- Useful for doing, e.g. spawnvp. Note that the current directory
- is always searched first! If the filename already contains a
- path specification (or extension) then the given path list
- (or extension list) is ignored.
- Returns the name by which the file was found, or NULL.
-
- Written by Eric R. Smith and placed in the public domain.
-
- rehacked by Uwe Ohse, 28.4.93, to support reentrant spawn/popen.
- */
-
#include <compiler.h>
#include <limits.h> /* needed for PATH_MAX */
#include <support.h>
- #include <stddef.h>
- #include <types.h>
- #include <stat.h>
- #include <string.h>
-
- /* characters used to separate components in a path list */
- #define PATHSEP1 ':'
- #define PATHSEP2 ','
-
- /* characters used to separate directory names in a file */
- #define DIRSEP1 '\\' /* native OS directory separator */
- #define DIRSEP2 '/' /* for emulating another OS */
-
- static char *const nullext[] = { NULL };
- static int EXISTS __PROTO((const char *));
-
- static int
- EXISTS(name)
- const char *name;
- {
- struct stat dummy;
-
- if (stat(name, &dummy) != 0)
- return 0;
- if ( (dummy.st_mode & S_IFMT) != S_IFREG )
- return 0;
- return 1;
- }
-
-
char *
findfile(fname, fpath, fext)
const char *fname, *fpath;
char *const *fext;
{
! /* simply calls buffindfile */
static char try[PATH_MAX];
! return buffindfile(fname,fpath,fext,try);
! }
!
!
! char *
! buffindfile(fname, fpath, fext, try)
! const char *fname, *fpath;
! char *const *fext, *try;
! {
! char *s, *extplace, *const *nextext, c;
! const char *t;
! int hasext = 0, haspath = 0;
!
! if (!fname || !*fname)
! return NULL;
!
! s = try; t = fname;
!
! /* copy the file in, checking to see if a path and/or extension are already
! given */
!
! while ( (c = *t++) != 0 )
! {
! if (c == DIRSEP1 || c == DIRSEP2)
! {
! haspath = 1;
! hasext = 0;
! }
! else if (c == '.')
! hasext = 1;
! *s++ = c;
! }
! extplace = s;
! *s = 0;
!
! if (haspath || !fpath)
! fpath = "";
! if (hasext || !fext)
! fext = nullext;
!
! for(;;) { /* loop on path elements */
! nextext = fext;
! if (!hasext) {
! extplace[0] = 0;
! extplace[1] = 0;
! }
!
! if (EXISTS(try))
! return try;
! extplace[0] = '.';
! while(*nextext) { /* loop on extensions */
! (void)strcpy(&extplace[1], *nextext++);
! if (EXISTS(try))
! return try;
! }
! if (!*fpath) break; /* no more places to look */
!
! /* copy in next element of path list */
! s = try;
! /* an attempt to accomodate within reason TOS specs -- mj */
! if (*(fpath + 1) == ':') {
! if ((*(fpath + 2) == DIRSEP1 ||
! *(fpath + 2) == DIRSEP2) &&
! (*fpath != '.' && *fpath != ':')) {
! *s++ = *fpath++;
! *s++ = *fpath++;
! *s++ = *fpath++;
! }
! }
! while ((c = *fpath) != 0 && c != PATHSEP1 && c != PATHSEP2) {
! *s++ = c;
! fpath++;
! }
! if (c)
! fpath++;
! *s++ = DIRSEP1;
! t = fname;
! while ((*s++ = *t++) != 0)
! ;
! extplace = --s ; /* where the extension gets written */
! }
! return NULL;
}
--- 1,13 ----
#include <compiler.h>
#include <limits.h> /* needed for PATH_MAX */
#include <support.h>
char *
findfile(fname, fpath, fext)
const char *fname, *fpath;
char *const *fext;
{
! /* simply calls _buffindfile */
static char try[PATH_MAX];
! return _buffindfile(fname,fpath,fext,try);
}
*** 41.1 1993/11/03 13:33:02
--- fopen.c 1994/01/09 11:11:58
***************
*** 71,81 ****
return(NULL); /* file open/create error */
}
if(isatty(h))
! f |= (_IODEV | _IOLBF);
else
f |= _IOFBF;
fp->_file = h; /* file handle */
fp->_flag = f; /* file status flags */
return(fp);
}
--- 71,83 ----
return(NULL); /* file open/create error */
}
if(isatty(h))
! f |= __mint ? (_IODEV | _IONBF| _IOBIN) : (_IODEV | _IONBF);
else
f |= _IOFBF;
fp->_file = h; /* file handle */
fp->_flag = f; /* file status flags */
+ if (iomode & O_APPEND)
+ (void) fseek(fp, 0L, SEEK_END);
return(fp);
}
*** 41.1 1993/11/03 13:33:02
--- getpw.c 1993/11/30 20:40:30
***************
*** 382,392 ****
*cp++ = 0x00;
curentry.pw_dir = cp;
for (; ((*cp != 0x00) && (*cp != ':')); cp++)
! ;
*cp++ = 0x00;
curentry.pw_shell = cp;
for (; ((*cp != 0x00) && (*cp != ':') && (*cp != '\n')); cp++)
! ;
*cp = 0x00;
if (curentry.pw_age == NULL)
curentry.pw_age = cp; /* Don't return NULL, return a null string */
--- 382,394 ----
*cp++ = 0x00;
curentry.pw_dir = cp;
for (; ((*cp != 0x00) && (*cp != ':')); cp++)
! if (*cp == '\\')
! *cp = '/';
*cp++ = 0x00;
curentry.pw_shell = cp;
for (; ((*cp != 0x00) && (*cp != ':') && (*cp != '\n')); cp++)
! if (*cp == '\\')
! *cp = '/';
*cp = 0x00;
if (curentry.pw_age == NULL)
curentry.pw_age = cp; /* Don't return NULL, return a null string */
*** 41.1 1993/11/03 13:33:02
--- lib.h 1993/11/30 18:49:56
***************
*** 63,69 ****
__EXTERN void _setstack __PROTO((char *));
__EXTERN void _crtinit __PROTO((void));
__EXTERN void _acc_main __PROTO((void));
! __EXTERN __EXITING __exit __PROTO((long status));
__EXTERN void _fclose_all_files __PROTO((void));
/* from the TOS GCC library */
--- 63,69 ----
__EXTERN void _setstack __PROTO((char *));
__EXTERN void _crtinit __PROTO((void));
__EXTERN void _acc_main __PROTO((void));
! __EXTERN __EXITING __exit __PROTO((long status)) __NORETURN;
__EXTERN void _fclose_all_files __PROTO((void));
/* from the TOS GCC library */
*** 41.1 1993/11/03 13:33:02
--- libgcc2.c 1993/11/30 18:50:02
***************
*** 36,41 ****
--- 36,46 ----
#include "gstddef.h"
#endif
+ /* Don't use `fancy_abort' here even if config.h says to use it. */
+ #ifdef abort
+ #undef abort
+ #endif
+
#else
/* For the atari, include the relevant parts of config/m68k.h directly. */
***************
*** 55,63 ****
#include <stddef.h>
#endif
! /* Define this if most significant byte of a word is the lowest numbered. */
! /* That is true on the 68000. */
! #define BYTES_BIG_ENDIAN 1
/* Define this if most significant word of a multiword number is the lowest
numbered. */
--- 60,77 ----
#include <stddef.h>
#endif
! #if 1
! /* Define for XFmode extended real floating point support. */
! #define LONG_DOUBLE_TYPE_SIZE 96
! #else
! /* Don't try using XFmode. */
! #define LONG_DOUBLE_TYPE_SIZE 64
! #endif
!
! /* Define this if most significant bit is lowest numbered
! in instructions that operate on numbered bit-fields.
! This is true for 68020 insns such as bfins and bfexts. */
! #define BITS_BIG_ENDIAN 1
/* Define this if most significant word of a multiword number is the lowest
numbered. */
***************
*** 69,76 ****
/* number of bits in an addressable storage unit */
#define BITS_PER_UNIT 8
! /* for this file this is always true, never compile anything in here with
! -mshort */
#define BITS_PER_WORD 32
/* This is the library routine that is used
--- 83,92 ----
/* number of bits in an addressable storage unit */
#define BITS_PER_UNIT 8
! /* Width in bits of a "word", which is the contents of a machine register.
! Note that this is not necessarily the width of data type `int';
! if using 16-bit ints on a 68000, this would still be 32.
! But on a machine with 16-bit registers, this would be 16. */
#define BITS_PER_WORD 32
/* This is the library routine that is used
***************
*** 172,177 ****
--- 188,199 ----
extern DItype __fixunssfdi (SFtype a);
extern DItype __fixunsdfdi (DFtype a);
+ #if LONG_DOUBLE_TYPE_SIZE == 96
+ extern DItype __fixunsxfdi (XFtype a);
+ #endif
+ #if LONG_DOUBLE_TYPE_SIZE == 128
+ extern DItype __fixunstfdi (TFtype a);
+ #endif
#if defined (L_negdi2) || defined (L_divdi3) || defined (L_moddi3)
#if defined (L_divdi3) || defined (L_moddi3)
***************
*** 697,702 ****
--- 719,725 ----
#ifdef L_divdi3
UDItype __udivmoddi4 ();
+
DItype
__divdi3 (u, v)
DItype u, v;
***************
*** 1094,1100 ****
#endif
#if defined(L_fixunsxfsi) && LONG_DOUBLE_TYPE_SIZE == 96
! #include "glimits.h"
USItype
__fixunsxfsi (a)
--- 1117,1123 ----
#endif
#if defined(L_fixunsxfsi) && LONG_DOUBLE_TYPE_SIZE == 96
! #include <limits.h>
USItype
__fixunsxfsi (a)
***************
*** 1150,1162 ****
/* frills for C++ */
! #ifdef L_builtin_new
#include <memory.h>
typedef void (*vfp)(void);
extern vfp __new_handler;
void *
__builtin_new (size_t sz)
{
--- 1173,1186 ----
/* frills for C++ */
! #ifdef L_op_new
#include <memory.h>
typedef void (*vfp)(void);
extern vfp __new_handler;
+ /* void * operator new (size_t sz) */
void *
__builtin_new (size_t sz)
{
***************
*** 1170,1178 ****
(*__new_handler) ();
return p;
}
! #endif
! #ifdef L_caps_New
/* Avoid forcing the library's meaning of `write' on the user program
by using the "internal" name (for use within the library) */
--- 1194,1202 ----
(*__new_handler) ();
return p;
}
! #endif /* L_op_new */
! #ifdef L_new_handler
/* Avoid forcing the library's meaning of `write' on the user program
by using the "internal" name (for use within the library) */
***************
*** 1185,1215 ****
vfp __new_handler = default_new_handler;
- void *
- __builtin_vec_new (p, maxindex, size, ctor)
- void *p;
- size_t maxindex;
- size_t size;
- void (*ctor)(void *);
- {
- size_t i;
- size_t nelts = maxindex + 1;
- void *rval;
-
- if (p == 0)
- p = __builtin_new (nelts * size);
-
- rval = p;
-
- for (i = 0; i < nelts; i++)
- {
- (*ctor) (p);
- p += size;
- }
-
- return rval;
- }
-
vfp
__set_new_handler (handler)
vfp handler;
--- 1209,1214 ----
***************
*** 1243,1283 ****
_exit (-1);
}
#endif
-
- #ifdef L_builtin_del
- typedef void (*vfp)(void);
void
__builtin_delete (void *ptr)
{
if (ptr)
free (ptr);
}
-
- void
- __builtin_vec_delete (ptr, maxindex, size, dtor, auto_delete_vec, auto_delete)
- void *ptr;
- size_t maxindex;
- size_t size;
- void (*dtor)(void *, int);
- int auto_delete;
- {
- size_t i;
- size_t nelts = maxindex + 1;
- void *p = ptr;
-
- ptr += nelts * size;
-
- for (i = 0; i < nelts; i++)
- {
- ptr -= size;
- (*dtor) (ptr, auto_delete);
- }
-
- if (auto_delete_vec)
- __builtin_delete (p);
- }
-
#endif
#ifdef L_trampoline
--- 1242,1256 ----
_exit (-1);
}
#endif
+ #ifdef L_op_delete
+ /* void operator delete (void *ptr) */
void
__builtin_delete (void *ptr)
{
if (ptr)
free (ptr);
}
#endif
#ifdef L_trampoline
*** 41.1 1993/11/03 13:33:02
--- longlong.h 1993/11/30 18:50:08
***************
*** 411,443 ****
: "=d" ((USItype)(count)) \
: "od" ((USItype)(x)), "n" (0))
#else /* not mc68020 */
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("| Inlined umul_ppmm
! movel %2,d0
! movel %3,d1
! movel d0,d2
! swap d0
! movel d1,d3
! swap d1
! movew d2,d4
! mulu d3,d4
! mulu d1,d2
! mulu d0,d3
! mulu d0,d1
! movel d4,d0
! eorw d0,d0
! swap d0
! addl d0,d2
! addl d3,d2
jcc 1f
! addl #65536,d1
! 1: swap d2
! moveq #0,d0
! movew d2,d0
! movew d4,d2
! movel d2,%1
! addl d1,d0
! movel d0,%0" \
: "=g" ((USItype)(xh)), \
"=g" ((USItype)(xl)) \
: "g" ((USItype)(a)), \
--- 411,444 ----
: "=d" ((USItype)(count)) \
: "od" ((USItype)(x)), "n" (0))
#else /* not mc68020 */
+ /* %/ inserts REGISTER_PREFIX. */
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("| Inlined umul_ppmm
! movel %2,%/d0
! movel %3,%/d1
! movel %/d0,%/d2
! swap %/d0
! movel %/d1,%/d3
! swap %/d1
! movew %/d2,%/d4
! mulu %/d3,%/d4
! mulu %/d1,%/d2
! mulu %/d0,%/d3
! mulu %/d0,%/d1
! movel %/d4,%/d0
! eorw %/d0,%/d0
! swap %/d0
! addl %/d0,%/d2
! addl %/d3,%/d2
jcc 1f
! addl #65536,%/d1
! 1: swap %/d2
! moveq #0,%/d0
! movew %/d2,%/d0
! movew %/d4,%/d2
! movel %/d2,%1
! addl %/d1,%/d0
! movel %/d0,%0" \
: "=g" ((USItype)(xh)), \
"=g" ((USItype)(xl)) \
: "g" ((USItype)(a)), \
*** 41.1 1993/11/03 13:33:02
--- strerror.c 1993/11/24 21:14:28
***************
*** 118,124 ****
/* Support for Kay Roemer's socket library */
! char *_sock_errlist[] = {
"Socket operation on non-socket", /* 300 */
"Destination address required",
"Message too long",
--- 118,124 ----
/* Support for Kay Roemer's socket library */
! char *const _sock_errlist[] = {
"Socket operation on non-socket", /* 300 */
"Destination address required",
"Message too long",
*** 41.1 1993/11/03 13:33:02
--- Bugs 1994/01/09 11:14:24
***************
*** 70,78 ****
change only CLOCKS_PER_SEC. CLK_TCK is used in times.c. CLOCKS_PER_SEC
is used in sleep.c.
- close.c, open.c: ++nox
- close(0); open (...); doesn't reopen 0 (stdin). (or does it now?)
-
crtinit.c: ++nox
Some programs like uuxqt (taylors at least) understand exit code
EX_TEMPFAIL (75) to mean retry the command (uux job) later. Now when
--- 70,75 ----
***************
*** 122,127 ****
--- 119,128 ----
[I disagree, limits.h should be strictly ANSI and is already polluted
as it is -entropy]
+ link.c: ++nox
+ link() returns the same error code for different things i.e. EACCESS when
+ it really means EEXIST.
+
localtim.c: ++nox
Fix localtime() etc. to get the start/end DST rules from $TZ...
***************
*** 149,154 ****
--- 150,160 ----
open.c: ++nox
Should open() do a TIOCSPGRP too when it Fforces the control tty?
I think, but i'm not 100% sure...
+ Currently errno is set to EPATH (ENOTDIR) in some cases where UNIX would
+ give EFILNF (ENOENT). The GEMDOS error codes should be translated by the
+ library in these cases. This affects open() and creat(), and possibly
+ other functions as well (check access(), unlink(), mkdir(), anything that
+ accesses files by name).
pgrp.c: ++entropy
The setsid() function never really disassociates the controlling tty from
***************
*** 215,220 ****
--- 221,231 ----
I'll accept it so long as there is a way (via an environment variable)
for the user to select the emulation as it is currently working. Fixes
to make the emulation more robust would also be welcome. -entropy]
+
+ thread.c: ++nox
+ tfork() doesn't know about -mbaserel, had to save a4 (base pointer)
+ myself for the child. (and all this only because we still don't have a
+ real vfork...)
types.h: ++entropy
Need ssize_t for POSIX compliance.
*** 41.1 1993/11/03 13:33:02
--- Changelog 1994/01/16 08:44:06
***************
*** 4,9 ****
--- 4,391 ----
Changes are listed in *reverse* order, most recent changes being
first.
+ PATCHLEVEL42::
+
+ ***** abs.c
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 20:23:16; author: pvt1-117; state: Exp; lines: +7 -0
+ Inline abs() and labs() for LCC.
+ =============================================================================
+ ***** bblink.c
+ ----------------------------
+ revision 41.3
+ date: 1994/01/13 08:03:50; author: schwab; state: Exp; lines: +29 -26
+ Fixed version of update for GCC 2.5
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:51:36; author: schwab; state: Exp; lines: +139 -2
+ Updated for GCC 2.5
+ =============================================================================
+ ***** buffindf.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:33:20; author: schwab; state: Exp;
+ NEW file.
+ The library uses the names findfile and buffindfile which are in the
+ user's namespace. findfile is not really used and should be move into
+ a separate file, and buffindfile should be renamed to _buffindfile.
+ I have renamed findfile.c to buffindf.c and moved the function
+ findfile into a new findfile.c, and changed all callers.
+ =============================================================================
+ ***** bzero.cpp
+ ----------------------------
+ revision 41.2
+ date: 1993/12/01 20:45:46; author: michal; state: Exp; lines: +2 -0
+ When Lmemset is defined and not Lbzero, the jump at the bottom
+ of the memset setup reduces to a zero offset jump. put a
+ #ifdef Lbzero (which amounts to really #ifdef Lmemset && Lbzero)
+ around the `jra do_set'.
+ =============================================================================
+ ***** fdopen.c
+ ----------------------------
+ revision 41.3
+ date: 1994/01/13 09:37:36; author: entropy; state: Exp; lines: +2 -0
+ *** empty log message ***
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 20:12:04; author: nox; state: Exp; lines: +1 -1
+ Use binary mode on tty's (under MiNT) to avoid extra ^M's.
+ =============================================================================
+ ***** findfile.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:29:32; author: schwab; state: Exp; lines: +2 -126
+ The library uses the names findfile and buffindfile which are in the
+ user's namespace. findfile is not really used and should be moved into
+ a separate file, and buffindfile should be renamed to _buffindfile.
+ I have renamed findfile.c to buffindf.c and moved the function
+ findfile into the new findfile.c, and changed all callers.
+ =============================================================================
+ ***** fopen.c
+ ----------------------------
+ revision 41.4
+ date: 1994/01/09 11:12:06; author: nox; state: Exp; lines: +2 -2
+ *** empty log message ***
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 11:06:16; author: nox; state: Exp; lines: +2 -0
+ In _fopen() we seek to the end when file mode "a" is used (the kernel
+ won't do this until the first write.)
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 20:12:34; author: nox; state: Exp; lines: +1 -1
+ Use binary mode on tty's (under MiNT) to avoid extra ^M's.
+ =============================================================================
+ ***** getpw.c
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 20:40:50; author: nox; state: Exp; lines: +4 -2
+ Convert backslashes in the home directory in the passwd file, for backwards
+ compatibility.
+ =============================================================================
+ ***** lib.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:51:48; author: schwab; state: Exp; lines: +1 -1
+ Use new way to declare a function that doesn't return, since
+ the old way wasn't ANSI conforming.
+ =============================================================================
+ ***** libgcc2.c
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:51:58; author: schwab; state: Exp; lines: +35 -62
+ New entry points: L_builtin_new, L_caps_New and L_builtin_del are replaced
+ by L_op_new, L_new_handler and L_op_delete.
+ =============================================================================
+ ***** longlong.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:52:22; author: schwab; state: Exp; lines: +25 -24
+ Updated for GCC 2.5
+ =============================================================================
+ ***** strerror.c
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 21:14:58; author: schwab; state: Exp; lines: +1 -1
+ Move _sock_errlist[] into the text segment by making it const, so that
+ -mbaserel works again.
+ =============================================================================
+ ***** include/PatchLev.h
+ ----------------------------
+ revision 41.3
+ date: 1993/11/04 03:26:16; author: entropy; state: Exp; lines: +0 -0
+ -
+ ----------------------------
+ revision 41.2
+ date: 1993/11/03 14:25:10; author: entropy; state: Exp; lines: +1 -1
+ -
+ =============================================================================
+ ***** include/assert.h
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 09:02:56; author: lux; state: Exp; lines: +4 -13
+ Make assert() macro more ANSI compliant by replacing the broken assert()
+ macro with what was previously given as assertval(), and remove
+ the assertval() macro.
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:50:46; author: schwab; state: Exp; lines: +1 -1
+ Use new way to declare a function that doesn't return, since
+ the old way wasn't ANSI conforming.
+ =============================================================================
+ ***** include/compiler.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:50:50; author: schwab; state: Exp; lines: +10 -0
+ Use new way to declare a function that doesn't return, since
+ the old way wasn't ANSI conforming.
+ =============================================================================
+ ***** include/gdbm.h
+ ----------------------------
+ revision 41.2
+ date: 1993/12/01 20:42:48; author: jrb; state: Exp; lines: +99 -21
+ Synchronize with update36.
+ =============================================================================
+ ***** include/ioctl.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 21:09:20; author: schwab; state: Exp; lines: +1 -0
+ Add definition of B134.
+ =============================================================================
+ ***** include/math-68881.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:50:58; author: schwab; state: Exp; lines: +112 -48
+ Give inline functions const attribute instead of declaring as const.
+ Fix a bug in atan2 where the function from libpml gives a different result
+ on the arguments (0, -1).
+ =============================================================================
+ ***** include/math.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 20:08:46; author: jrb; state: Exp; lines: +28 -24
+ allow define NO_INLINE_MATH to override _M68881_. Also, check
+ for __GNUC_INLINE__ as a pre-requisite to inlining (so the user
+ may override globally with __NO_INLINE__.
+ =============================================================================
+ ***** include/minimal.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:51:10; author: schwab; state: Exp; lines: +4 -3
+ Use new way to declare a function that doesn't return, since
+ the old way wasn't ANSI conforming.
+ =============================================================================
+ ***** include/mintbind.h
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 10:01:00; author: pvt1-117; state: Exp; lines: +1 -1
+ Some changes for Lattice C.
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 20:50:10; author: hohmuth; state: Exp; lines: +1 -1
+ Fix return type of Pwaitpid() for Pure C.
+ =============================================================================
+ ***** include/osbind.h
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 10:01:28; author: pvt1-117; state: Exp; lines: +3 -3
+ Some changes for Lattice C.
+ =============================================================================
+ ***** include/stdlib.h
+ ----------------------------
+ revision 41.3
+ date: 1993/11/30 18:51:16; author: schwab; state: Exp; lines: +3 -3
+ Use new way to declare a function that doesn't return, since
+ the old way wasn't ANSI conforming.
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 20:20:46; author: pvt1-117; state: Exp; lines: +10 -0
+ Inline abs() and labs() for LCC.
+ =============================================================================
+ ***** include/support.h
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 09:28:44; author: schwab; state: Exp; lines: +1 -1
+ Rename buffindfile() to _buffindfile().
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:51:22; author: schwab; state: Exp; lines: +2 -2
+ Use new way to declare a function that doesn't return, since
+ the old way wasn't ANSI conforming.
+ =============================================================================
+ ***** include/termios.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 21:10:38; author: schwab; state: Exp; lines: +1 -0
+ Add definition of B134.
+ =============================================================================
+ ***** include/unistd.h
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:51:28; author: schwab; state: Exp; lines: +1 -1
+ Use new way to declare a function that doesn't return, since
+ the old way wasn't ANSI conforming.
+ =============================================================================
+ ***** dup.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 10:31:12; author: roemer; state: Exp; lines: +3 -1
+ Make dup2(x, x) return x without doing anything, instead of failing.
+ [I also removed the "close(handle2);" since this violates POSIX and
+ the Fforce() already closes the target handle for us -entropy]
+ =============================================================================
+ ***** execp.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:28:56; author: schwab; state: Exp; lines: +1 -1
+ Rename buffindfile() to _buffindfile().
+ =============================================================================
+ ***** fopenp.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:29:04; author: schwab; state: Exp; lines: +1 -1
+ Rename buffindfile() to _buffindfile().
+ =============================================================================
+ ***** main.c
+ ----------------------------
+ revision 41.4
+ date: 1994/01/09 10:15:48; author: dsb; state: Exp; lines: +32 -30
+ Cast malloc() calls for HSC.
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 09:11:18; author: dirk_haun; state: Exp; lines: +2 -2
+ Some time ago, I reported a bug in main.c of MiNT lib PL39, which destroys
+ long PATH enviroment variables. Unfortunately, the bugfix itself was buggy
+ :-( If PATH consisted only of a null byte, followed by the root directory of
+ the boot drive, the result was garbage. E.g. PATH=\0C:\\ resulted in
+ PATH=/dev/c/nvurhgb so we allow for a size increase of up to five times the
+ original instead of four.
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 20:35:52; author: dirk_haun; state: Exp; lines: +2 -2
+ _path_dos2unx enlarges the path by at most *four* times the number of
+ elements, not two (with the old code, ";C:\;C:\CMD;E:\METAFONT" becomes
+ ":/dev/c/:/dev/c/cmd:/dev/e/meta".
+ =============================================================================
+ ***** mincl
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 11:15:20; author: entropy; state: Exp; lines: +1 -1
+ *** empty log message ***
+ ----------------------------
+ revision 41.2
+ date: 1993/11/30 18:52:44; author: schwab; state: Exp; lines: +2 -2
+ Add new libgcc2 targets.
+ =============================================================================
+ ***** open.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 10:47:04; author: roemer; state: Exp; lines: +3 -2
+ O_EXCL was being used incorrectly. It is only used in relation to
+ O_CREAT and has nothing to do with file sharing modes. So we add
+ it to modemask (allowing it to be passed through to Fopen()) and always
+ use O_DENYNONE.
+ =============================================================================
+ ***** scanf.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:56:18; author: schab; state: Exp; lines: +230 -182
+ The patch corrects these two bugs:
+ - sscanf ("1", "%d%n", &i, &n) fails to set n, generally the value was
+ off-by-one in the other cases
+ - sscanf ("0x10", "%x", &i) sets i to 0 instead of 16
+
+ Additionally i have implemented %p and %Lf (the latter only for
+ M68881, since there is no long double support without fpu yet), and i
+ have restructured the code to make it more efficient.
+ =============================================================================
+ ***** spawn.c
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 09:29:10; author: schwab; state: Exp; lines: +1 -1
+ Rename buffindfile() to _buffindfile().
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 21:06:22; author: schwab; state: Exp; lines: +8 -5
+ When running the interpreter for a script, the full pathname of the
+ script should be passed, and not only the string from argv[0]. The
+ latter normally does not include a path if the script was found
+ through $PATH.
+ =============================================================================
+ ***** spawnvp.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:29:24; author: schwab; state: Exp; lines: +1 -1
+ Rename buffindfile() to _buffindfile().
+ =============================================================================
+ ***** sync.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:52:04; author: schwab; state: Exp; lines: +9 -1
+ fsync() uses the value from st_dev in the stat structure to form a
+ pathname for Dcntl. This value can be > 0x100 for filesystems mounted
+ via FS_MOUNT. Currently there is no way to sync such a filesystem, i
+ have changed fsync to just return successfully in this case.
+ =============================================================================
+ ***** tcattr.c
+ ----------------------------
+ revision 41.2
+ date: 1993/11/24 21:11:36; author: schwab; state: Exp; lines: +4 -5
+ Make better mappings between termios attributes and real attributes,
+ and fix typos.
+ =============================================================================
+ ***** thread.c
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 18:13:30; author: entropy; state: Exp; lines: +21 -0
+ entropy's attempt at implementing nox's idea for getting tfork() to
+ work with -mbaserel. Untested.
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:49:06; author: schwab; state: Exp; lines: +2 -2
+ This patch for MiNTlib PL41 fixes the memory leak. It just moves the
+ calls to Mfree to the right place.
+ =============================================================================
+ ***** unx2dos.c
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 09:46:10; author: schwab; state: Exp; lines: +6 -4
+ When given an empty path, _path_unx2dos/_path_dos2unx trash the byte
+ before the supplied buffer. This can be seen by executing
+ PATH= printenv
+ (under sh or bash), there will be a line beginning with "PATH", but no
+ equal sign and probably some garbage behind.
+ =============================================================================
+ ***** crlf/crlf.c
+ ----------------------------
+ revision 41.3
+ date: 1994/01/09 14:38:22; author: entropy; state: Exp; lines: +386 -386
+ *** empty log message ***
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 14:35:58; author: entropy; state: Exp; lines: +386 -296
+ Merged changes from Markus Kilbinger and Martin Koehling.
+ =============================================================================
+ ***** crlf/crlf.doc
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 14:40:52; author: entropy; state: Exp; lines: +7 -3
+ *** empty log message ***
+ =============================================================================
+ ***** crlf/crlf.ttp
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 14:42:16; author: entropy; state: Exp; lines: +276 -271
+ *** empty log message ***
+ =============================================================================
+ ***** crlf/makefile
+ ----------------------------
+ revision 41.2
+ date: 1994/01/09 14:42:46; author: entropy; state: Exp; lines: +1 -3
+ *** empty log message ***
+ =============================================================================
+
PATCHLEVEL41::
***** nlist.c
*** 41.1 1993/11/03 13:33:02
--- Files 1994/01/09 09:41:32
***************
*** 7,40 ****
_normsf.cpp _truncdf.cpp _udivmod.s _umulsi3.s a64l.c \
abort.c abs.c access.c alglobal.c alloca.cpp \
alphasor.c atof.c atol.c bblink.c bcmp.c \
! bcopy.cpp binmode.c bsearch.c bzero.cpp calloc.c \
! chdir.c chmod.c ctermid.c ctime.c ctype.c \
! cuserid.c defmode.c difftime.c div.c div.cpp \
! doprnt.c eprintf.c errbase.h fclose.c fdopen.c \
! fflush.c ffs.c fgetc.c fgets.c filbuf.c \
! findfile.c flonum.h fopen.c fprintf.c fputc.c \
! fputs.c fread.c frexp.cpp frwbin.c fseek.c \
! fsetpos.c ftw.c fungetc.c fwrite.c gbl-ctors.h \
! getbuf.c getenv.c getlogin.c getopt.c getpass.c \
! getpid.c getpw.c gets.c getuid.c getw.c \
! gmon.c gnulib2.c grp.c ic.c ig.c \
! il.c ip.c iw.c ldexp.cpp lib.h \
! libgcc1.c libgcc2.c linea.c localtim.c longlong.h \
! lseek.c ltoa.c malloc.c memccpy.c memchr.c \
! memcmp.c mktemp.c modf.cpp nlist.c obstack.c \
! perror.c pgrp.c printf.c psignal.c putenv.c \
! qsort.c raise.c rand.c random.c realloc.c \
! regexp.c regsup.c sbrk.c setbuf.c setjmp.cpp \
! setlocal.c setvbuf.c sgtty.c siglist.c sprintf.c \
! stksiz.c strcat.c strchr.c strcmp.c strcoll.c \
! strcpy.c strcspn.c strdup.c strerror.c strftime.c \
! stricmp.c strlen.c strlwr.c strncat.c strncmp.c \
! strncpy.c strnicmp.c strpbrk.c strrchr.c strrev.c \
! strspn.c strstr.c strtok.c strtol.c strtoul.c \
! strupr.c system.c sysvar.c textio.c time.c \
! timeoday.c tmpfile.c tmpnam.c toxxx.c utime.c \
! vfprintf.c vprintf.c wcmb.c wcscat.c wcscmp.c \
! wcscpy.c wcslen.c wnull.c \
MINTLIB= \
GMakefile.16 GMakefile.32 GNUGPL2 Makefile alarm.c \
--- 7,40 ----
_normsf.cpp _truncdf.cpp _udivmod.s _umulsi3.s a64l.c \
abort.c abs.c access.c alglobal.c alloca.cpp \
alphasor.c atof.c atol.c bblink.c bcmp.c \
! bcopy.cpp binmode.c bsearch.c buffindf.c bzero.cpp \
! calloc.c chdir.c chmod.c ctermid.c ctime.c \
! ctype.c cuserid.c defmode.c difftime.c div.c \
! div.cpp doprnt.c eprintf.c errbase.h fclose.c \
! fdopen.c fflush.c ffs.c fgetc.c fgets.c \
! filbuf.c findfile.c flonum.h fopen.c fprintf.c \
! fputc.c fputs.c fread.c frexp.cpp frwbin.c \
! fseek.c fsetpos.c ftw.c fungetc.c fwrite.c \
! gbl-ctors.h getbuf.c getenv.c getlogin.c getopt.c \
! getpass.c getpid.c getpw.c gets.c getuid.c \
! getw.c gmon.c gnulib2.c grp.c ic.c \
! ig.c il.c ip.c iw.c ldexp.cpp \
! lib.h libgcc1.c libgcc2.c linea.c localtim.c \
! longlong.h lseek.c ltoa.c malloc.c memccpy.c \
! memchr.c memcmp.c mktemp.c modf.cpp nlist.c \
! obstack.c perror.c pgrp.c printf.c psignal.c \
! putenv.c qsort.c raise.c rand.c random.c \
! realloc.c regexp.c regsup.c sbrk.c setbuf.c \
! setjmp.cpp setlocal.c setvbuf.c sgtty.c siglist.c \
! sprintf.c stksiz.c strcat.c strchr.c strcmp.c \
! strcoll.c strcpy.c strcspn.c strdup.c strerror.c \
! strftime.c stricmp.c strlen.c strlwr.c strncat.c \
! strncmp.c strncpy.c strnicmp.c strpbrk.c strrchr.c \
! strrev.c strspn.c strstr.c strtok.c strtol.c \
! strtoul.c strupr.c system.c sysvar.c textio.c \
! time.c timeoday.c tmpfile.c tmpnam.c toxxx.c \
! utime.c vfprintf.c vprintf.c wcmb.c wcscat.c \
! wcscmp.c wcscpy.c wcslen.c wnull.c \
MINTLIB= \
GMakefile.16 GMakefile.32 GNUGPL2 Makefile alarm.c \
*** 41.1 1993/11/03 13:33:02
--- Makefile.adm 1993/11/04 03:28:18
***************
*** 95,102 ****
done
newversion:
! for dir in . $(incdir) $(incdir)/sys crlf lattice purec \
! purec/unixname sozobon ;\
do \
cd $$dir ;\
ci -l -f -m- -r$V.1 RCS/* ;\
--- 95,103 ----
done
newversion:
! for dir in $(srcdir) $(srcdir)/crlf $(srcdir)/lattice \
! $(srcdir)/purec $(srcdir)/purec/unixname \
! $(srcdir)/sozobon $(incdir) $(incdir)/sys ;\
do \
cd $$dir ;\
ci -l -f -m- -r$V.1 RCS/* ;\
*** 41.1 1993/11/03 13:33:02
--- PatchLev.h 1993/11/04 03:25:48
***************
*** 3,6 ****
* directory.
*/
! #define PatchLevel "41"
--- 3,6 ----
* directory.
*/
! #define PatchLevel "42"
*** 41.1 1993/11/03 13:33:02
--- Version 1993/11/04 03:25:54
***************
*** 1 ****
! V=41
--- 1 ----
! V=42
*** 41.1 1993/11/03 13:33:02
--- dup.c 1994/01/09 10:30:52
***************
*** 56,62 ****
int rv;
long flags;
! close(handle2);
if ((rv = (int)Fforce(handle2, handle1)) < 0)
errno = -rv;
else {
--- 56,64 ----
int rv;
long flags;
! if (handle1 == handle2)
! return (handle2);
!
if ((rv = (int)Fforce(handle2, handle1)) < 0)
errno = -rv;
else {
*** 41.1 1993/11/03 13:33:02
--- execp.c 1994/01/09 09:16:02
***************
*** 30,36 ****
{
const char *execname;
char buffer[PATH_MAX];
! execname = buffindfile(name, getenv("PATH"), extensions,buffer);
if (!execname) {
errno = ENOENT;
return -1; /* file not found */
--- 30,36 ----
{
const char *execname;
char buffer[PATH_MAX];
! execname = _buffindfile(name, getenv("PATH"), extensions,buffer);
if (!execname) {
errno = ENOENT;
return -1; /* file not found */
*** 41.1 1993/11/03 13:33:02
--- fopenp.c 1994/01/09 09:16:06
***************
*** 15,21 ****
char *fullname;
char buffer[PATH_MAX];
! fullname = buffindfile(name, getenv("PATH"), (char **)0, buffer);
if (!fullname) {
errno = ENOENT;
return NULL;
--- 15,21 ----
char *fullname;
char buffer[PATH_MAX];
! fullname = _buffindfile(name, getenv("PATH"), (char **)0, buffer);
if (!fullname) {
errno = ENOENT;
return NULL;
*** 41.1 1993/11/03 13:33:02
--- main.c 1994/01/09 10:09:50
***************
*** 196,216 ****
}
if (!strncmp(s, p, len) && s[len] == '=') {
! len++;
! tmp = s + len; /* tmp now after '=' */
! cnt = 1;
! while (*tmp) { /* count words */
! if (*tmp == ';' || *tmp == ',')
! cnt++;
! tmp++;
! }
! _envp[i] = (char *) malloc(tmp - s + cnt * 2);
! strncpy(_envp[i], s, len);
! _path_dos2unx(s + len, _envp[i] + len);
! _envp[i] = (char *) realloc(_envp[i],
! strlen(_envp[i]) + 1);
!
! break;
}
if (! *tmp) break;
--- 196,217 ----
}
if (!strncmp(s, p, len) && s[len] == '=') {
! len++;
! tmp = s + len; /* tmp now after '=' */
! cnt = 1;
! while (*tmp) { /* count words */
! if (*tmp == ';' || *tmp == ',')
! cnt++;
! tmp++;
! }
! _envp[i] = (char *)
! malloc((size_t)
! (tmp - s + cnt * 5));
! strncpy(_envp[i], s, len);
! _path_dos2unx(s + len, _envp[i] + len);
! _envp[i] = (char *) realloc(_envp[i],
! strlen(_envp[i]) + 1);
! break;
}
if (! *tmp) break;
***************
*** 223,243 ****
if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
s[3] == 'H' && s[4] == '=')
{
! tmp = s + 5; /* tmp now after '=' */
! cnt = 1;
! while (*tmp)
! {
! /* count words */
! if (*tmp == ';' || *tmp == ',')
! cnt++;
! tmp++;
! }
! _envp[i] = (char *) malloc(tmp - s + cnt * 2);
! strncpy(_envp[i], s, 5);
! _path_dos2unx(s + 5, _envp[i] + 5);
! _envp[i] = (char *) realloc(_envp[i],
! strlen(_envp[i]) + 1);
! break;
}
}
}
--- 224,245 ----
if (s[0] == 'P' && s[1] == 'A' && s[2] == 'T' &&
s[3] == 'H' && s[4] == '=')
{
! tmp = s + 5; /* tmp now after '=' */
! cnt = 1;
! while (*tmp)
! {
! /* count words */
! if (*tmp == ';' || *tmp == ',')
! cnt++;
! tmp++;
! }
! _envp[i] = (char *) malloc((size_t)
! (tmp - s + cnt * 5));
! strncpy(_envp[i], s, 5);
! _path_dos2unx(s + 5, _envp[i] + 5);
! _envp[i] = (char *) realloc(_envp[i],
! strlen(_envp[i]) + 1);
! break;
}
}
}
*** 41.1 1993/11/03 13:33:02
--- mincl 1994/01/09 09:38:10
***************
*** 11,18 ****
GLIB2 = _muldi3.o _divdi3.o _moddi3.o _udivdi3.o _umoddi3.o _negdi2.o \
_lshrdi3.o _lshldi3.o _ashldi3.o _ashrdi3.o _udivmoddi4.o _cmpdi2.o \
_ucmpdi2.o _floatdidf.o _floatdisf.o _fixunsdfsi.o _fixunssfsi.o \
! _fixunsdfdi.o _fixdfdi.o _fixunssfdi.o _fixsfdi.o _builtin_new.o \
! _caps_New.o _builtin_del.o _trampoline.o __main.o _ctor_list.o \
_dtor_list.o _ffsdi2.o
GCC= crtinit.o stksiz.o inistack.o heapbase.o binmode.o \
--- 11,18 ----
GLIB2 = _muldi3.o _divdi3.o _moddi3.o _udivdi3.o _umoddi3.o _negdi2.o \
_lshrdi3.o _lshldi3.o _ashldi3.o _ashrdi3.o _udivmoddi4.o _cmpdi2.o \
_ucmpdi2.o _floatdidf.o _floatdisf.o _fixunsdfsi.o _fixunssfsi.o \
! _fixunsdfdi.o _fixdfdi.o _fixunssfdi.o _fixsfdi.o _op_new.o \
! _new_handler.o _op_delete.o _trampoline.o __main.o _ctor_list.o \
_dtor_list.o _ffsdi2.o
GCC= crtinit.o stksiz.o inistack.o heapbase.o binmode.o \
***************
*** 43,49 ****
#
# other miscellaneous stuff
! PORT = a64l.o alphasor.o abs.o ctermid.o cuserid.o \
ffs.o findfile.o fopenp.o frwbin.o ftw.o \
gethostn.o getlogin.o getopt.o getpages.o getpass.o getpw.o grp.o \
mktemp.o nlist.o obstack.o \
--- 43,49 ----
#
# other miscellaneous stuff
! PORT = a64l.o alphasor.o abs.o buffindf.o ctermid.o cuserid.o \
ffs.o findfile.o fopenp.o frwbin.o ftw.o \
gethostn.o getlogin.o getopt.o getpages.o getpass.o getpw.o grp.o \
mktemp.o nlist.o obstack.o \
*** 41.1 1993/11/03 13:33:02
--- open.c 1994/01/09 10:46:32
***************
*** 78,85 ****
iomode = iomode & ~O_SHMODE;
if (__mint >= 9) {
! modemask = O_ACCMODE | O_SHMODE | O_SYNC | O_NDELAY | O_CREAT | O_TRUNC;
! iomode |= (iomode & O_EXCL) ? O_DENYRW : O_DENYNONE;
if (__mint >= 96) {
modemask |= _REALO_APPEND;
if (iomode & O_APPEND)
--- 78,86 ----
iomode = iomode & ~O_SHMODE;
if (__mint >= 9) {
! modemask = O_ACCMODE | O_SHMODE | O_SYNC | O_NDELAY
! | O_CREAT | O_TRUNC | O_EXCL;
! iomode |= O_DENYNONE;
if (__mint >= 96) {
modemask |= _REALO_APPEND;
if (iomode & O_APPEND)
*** 41.1 1993/11/03 13:33:02
--- scanf.c 1994/01/09 09:54:40
***************
*** 3,9 ****
#include <string.h>
#include <stdarg.h>
#include "lib.h"
!
/*
* %efg were loosing big time
* fixed ++jrb
--- 3,9 ----
#include <string.h>
#include <stdarg.h>
#include "lib.h"
!
/*
* %efg were loosing big time
* fixed ++jrb
***************
*** 16,30 ****
#ifndef __NO_FLOAT__
#define FLOATS 1
#endif
!
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
-
- extern char _numstr[];
! #define skip() while(isspace(c)) { charcnt++; if ((c=(*get)(ip))<1) goto done; }
#define TEN_MUL(X) ((((X) << 2) + (X)) << 1)
#if FLOATS
--- 16,29 ----
#ifndef __NO_FLOAT__
#define FLOATS 1
#endif
!
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
! #define skip() \
! while (isspace(c)) { charcnt++; c = (*get)(ip); if (c == EOF) goto done; }
#define TEN_MUL(X) ((((X) << 2) + (X)) << 1)
#if FLOATS
***************
*** 89,95 ****
int (*unget)(int, FILE *), const char *_fmt, va_list args)
#else
int
! _scanf(ip, get, unget, fmt, args)
FILE *ip;
int (*get) __PROTO((FILE *));
int (*unget) __PROTO((int, FILE *));
--- 88,94 ----
int (*unget)(int, FILE *), const char *_fmt, va_list args)
#else
int
! _scanf(ip, get, unget, _fmt, args)
FILE *ip;
int (*get) __PROTO((FILE *));
int (*unget) __PROTO((int, FILE *));
***************
*** 99,262 ****
{
register long n;
register int c, width, lval, sval, cnt = 0, charcnt = 1;
#ifdef PRINTF_LONGLONG
- register int llval=0;
register long long lln;
#endif
! int store, neg, base, wide1, endnull, rngflag, c2;
register unsigned char *p = 0;
const unsigned char *fmt = (const unsigned char *) _fmt;
! unsigned char delim[128], digits[17], *q;
#if FLOATS
double fx;
char fbuf[128], *fbp;
int fstate, trans;
extern double atof __PROTO((const char *));
#endif
!
! if (!*fmt)
! return(0);
!
c = (*get)(ip);
! while(c > 0)
{
- store = FALSE;
if (*fmt == '%')
{
- n = 0;
width = -1;
- wide1 = 1;
- base = 10;
lval = FALSE;
! #ifdef PRINTF_LONGLONG
llval = FALSE;
- lln = 0;
#endif
sval = FALSE;
store = TRUE;
! endnull = TRUE;
! neg = -1;
!
! strcpy((char *)delim, "\011\012\013\014\015 ");
! strcpy((char *)digits, (const char *)_numstr); /* "01234567890ABCDEF" */
!
! if (fmt[1] == '*')
{
! endnull = store = FALSE;
++fmt;
}
!
! while (isdigit(*++fmt)) /* width digit(s) */
! {
! if (width == -1)
! width = 0;
! wide1 = width = TEN_MUL(width) + (*fmt - '0');
! }
! --fmt;
fmtnxt:
! ++fmt;
! switch(tolower(*fmt)) /* tolower() is a MACRO! */
{
- case '*':
- endnull = store = FALSE;
- goto fmtnxt;
-
case 'l': /* long data */
#ifdef PRINTF_LONGLONG
if (lval)
llval = TRUE;
#endif
lval = TRUE;
case 'h': /* short data (for compatibility) */
sval = TRUE;
goto fmtnxt;
!
case 'i': /* any-base numeric */
base = 0;
goto numfmt;
!
! case 'b': /* unsigned binary */
base = 2;
goto numfmt;
!
case 'o': /* unsigned octal */
base = 8;
goto numfmt;
!
case 'x': /* unsigned hexadecimal */
base = 16;
goto numfmt;
!
case 'd': /* SIGNED decimal */
! neg = FALSE;
! /* FALL-THRU */
!
case 'u': /* unsigned decimal */
! numfmt: skip();
!
! if (isupper(*fmt)) {
#ifdef PRINTF_LONGLONG
if (lval) llval = TRUE;
#endif
lval = TRUE;
! }
if (!base)
{
! base = 10;
! neg = FALSE;
! if (c == '%')
{
base = 2;
goto skip1;
}
else if (c == '0')
{
charcnt++;
c = (*get)(ip);
! if (c < 1)
goto savnum;
if ((c != 'x')
&& (c != 'X'))
{
base = 8;
! digits[8]= '\0';
goto zeroin;
}
base = 16;
goto skip1;
}
}
!
! if ((neg == FALSE) && (base == 10)
! && (((neg = (c == '-')) != 0) || (c == '+')))
! {
! skip1:
charcnt++;
! c = (*get)(ip);
! if (c < 1)
! goto done;
! }
!
! digits[base] = '\0';
! p = ((unsigned char *)
! strchr((const char *)digits,toupper(c)));
!
! if ((!c || !p) && width)
! goto done;
!
! while (p && width-- && c)
{
#ifdef PRINTF_LONGLONG
if (llval)
! lln = (lln * base) + (p - digits);
else
#endif
! n = (n * base) + (p - digits);
charcnt++;
c = (*get)(ip);
zeroin:
! p = ((unsigned char *)
! strchr((const char *)digits,toupper(c)));
}
savnum:
if (store)
--- 98,313 ----
{
register long n;
register int c, width, lval, sval, cnt = 0, charcnt = 1;
+ #if defined (PRINTF_LONGLONG) || defined (__STDC__)
+ register int llval = 0;
+ #endif
#ifdef PRINTF_LONGLONG
register long long lln;
#endif
! int store, neg, base, endnull, c2;
register unsigned char *p = 0;
const unsigned char *fmt = (const unsigned char *) _fmt;
! char delim[256], *q;
#if FLOATS
double fx;
char fbuf[128], *fbp;
int fstate, trans;
extern double atof __PROTO((const char *));
#endif
!
c = (*get)(ip);
! while (*fmt)
{
if (*fmt == '%')
{
width = -1;
lval = FALSE;
! #if defined (PRINTF_LONGLONG) || defined (__STDC__)
llval = FALSE;
#endif
sval = FALSE;
store = TRUE;
!
! if (*++fmt == '*')
{
! store = FALSE;
++fmt;
}
!
! if (isdigit (*fmt)) /* width digit(s) */
! {
! width = *fmt++ - '0';
! while (isdigit (*fmt))
! width = TEN_MUL (width) + *fmt++ - '0';
! }
!
fmtnxt:
! switch(*fmt++)
{
case 'l': /* long data */
#ifdef PRINTF_LONGLONG
if (lval)
llval = TRUE;
#endif
lval = TRUE;
+ goto fmtnxt;
+
+ #ifdef __STDC__
+ case 'L': /* long double */
+ llval = TRUE;
+ goto fmtnxt;
+ #endif
+
case 'h': /* short data (for compatibility) */
sval = TRUE;
goto fmtnxt;
!
case 'i': /* any-base numeric */
base = 0;
+ neg = -1;
goto numfmt;
!
! case 'b': /* unsigned binary, non-standard */
! case 'B': /* non-standard */
base = 2;
+ neg = 0;
goto numfmt;
!
case 'o': /* unsigned octal */
+ case 'O': /* non-standard */
base = 8;
+ neg = 0;
goto numfmt;
!
! case 'p': /* pointer */
! lval = TRUE;
! #ifdef PRINTF_LONGLONG
! llval = FALSE;
! #endif
! /* fall through */
!
case 'x': /* unsigned hexadecimal */
+ case 'X': /* non-standard */
base = 16;
+ neg = 0;
goto numfmt;
!
case 'd': /* SIGNED decimal */
! case 'D': /* non-standard */
! base = 10;
! neg = -1;
! goto numfmt;
!
case 'u': /* unsigned decimal */
! case 'U': /* non-standard */
! base = 10;
! neg = 0;
! numfmt:
! skip();
! memset (delim, -1, sizeof (delim));
! if (isupper(fmt[-1])) {
! /* non-standard */
#ifdef PRINTF_LONGLONG
if (lval) llval = TRUE;
#endif
lval = TRUE;
! }
! n = 0;
! #ifdef PRINTF_LONGLONG
! lln = 0;
! #endif
! if (width == 0)
! goto savnum;
if (!base)
{
! if (c == '%') /* non-standard */
{
base = 2;
+ neg = 0;
goto skip1;
}
else if (c == '0')
{
+ if (--width == 0)
+ goto savnum;
charcnt++;
c = (*get)(ip);
! if (c == EOF)
goto savnum;
if ((c != 'x')
&& (c != 'X'))
{
base = 8;
! neg = 0;
! for (c2 = 0; c2 < 8; c2++)
! delim[c2 + '0'] = c2;
goto zeroin;
}
base = 16;
+ neg = 0;
goto skip1;
}
+ else
+ base = 10;
}
!
! /* Check for 0x prefix */
! if (base == 16 && c == '0')
! {
! if (--width == 0)
! goto savnum;
charcnt++;
! c = (*get) (ip);
! if (c == EOF)
! goto done;
! if (c == 'x' || c == 'X')
! goto skip1;
! }
! else if (neg == -1)
! {
! neg = c == '-';
! if (neg || c == '+')
! {
! skip1:
! if (--width == 0)
! goto done;
! charcnt++;
! c = (*get)(ip);
! if (c == EOF)
! goto done;
! }
! }
!
! /* delim[c] -> value of c or -1 */
! p = (unsigned char *) "FEDCBAfedcba9876543210";
! q = "\17\16\15\14\13\12\17\16\15\14\13\12\11\10\7\6\5\4\3\2\1\0";
! if (base < 16)
! {
! /* skip invalid digits */
! p += 22 - base;
! q += 22 - base;
! }
! while (*p)
! delim[*p++] = *q++;
!
! if (delim[c] == (char) -1)
! goto done;
!
! while (width--)
{
#ifdef PRINTF_LONGLONG
if (llval)
! lln = (lln * base) + delim[c];
else
#endif
! n = (n * base) + delim[c];
charcnt++;
c = (*get)(ip);
+ if (c == EOF)
+ break;
zeroin:
! if (delim[c] == (char) -1)
! break;
}
savnum:
if (store)
***************
*** 269,282 ****
#ifdef PRINTF_LONGLONG
if (llval)
{
! if (neg == TRUE)
lln=-lln;
*((long long*) p) = lln;
}
else
#endif
{
! if (neg == TRUE)
n = -n;
if (lval)
*((long*) p) = n;
--- 320,333 ----
#ifdef PRINTF_LONGLONG
if (llval)
{
! if (neg)
lln=-lln;
*((long long*) p) = lln;
}
else
#endif
{
! if (neg)
n = -n;
if (lval)
*((long*) p) = n;
***************
*** 288,327 ****
}
}
break;
!
#if FLOATS
case 'e': /* float */
case 'f':
case 'g':
skip();
!
! if (isupper(*fmt))
! lval = TRUE;
!
fstate = FS_INIT;
fbp = fbuf;
! while (c && width--) {
! if (c >= '0' && c <= '9')
! trans = FC_DIG;
! else if (c == '.')
! trans = FC_DOT;
! else if (c == '+' || c == '-')
! trans = FC_SIGN;
! else if (tolower(c) == 'e')
! trans = FC_E;
! else
! goto fdone;
!
! *fbp++ = c;
if (fp_do[trans][fstate] == F_QUIT)
! goto fdone;
fstate = fp_ns[trans][fstate];
charcnt++;
c = (*get)(ip);
}
!
! fdone:
*fbp = '\0';
if (!fp_sval[fstate])
goto done;
--- 339,380 ----
}
}
break;
!
#if FLOATS
+ case 'E': /* non-standard */
+ case 'F':
+ case 'G':
+ lval = TRUE;
+ /* fall through */
+
case 'e': /* float */
case 'f':
case 'g':
skip();
!
! memset (delim, -1, sizeof (delim));
! for (c2 = '0'; c2 <= '9'; c2++)
! delim[c2] = FC_DIG;
! delim['.'] = FC_DOT;
! delim['+'] = delim['-'] = FC_SIGN;
! delim['e'] = delim['E'] = FC_E;
!
fstate = FS_INIT;
fbp = fbuf;
! while (c != EOF && width--) {
! trans = delim[c];
! if (trans == (char) -1)
! break;
! if (fbp - fbuf + 1 < sizeof (fbuf))
! *fbp++ = c;
if (fp_do[trans][fstate] == F_QUIT)
! break;
fstate = fp_ns[trans][fstate];
charcnt++;
c = (*get)(ip);
}
!
*fbp = '\0';
if (!fp_sval[fstate])
goto done;
***************
*** 332,337 ****
--- 385,398 ----
#else
p = (unsigned char *) *args;
#endif
+ #ifdef __STDC__
+ /* partial support for long double */
+ #ifdef __M68881__ /* currently only with m68881 */
+ if (llval)
+ *(long double *) p = (long double) fx;
+ else
+ #endif
+ #endif
if (lval)
*((double *) p) = fx;
else
***************
*** 340,346 ****
}
break;
#endif
!
case 'n':
if (store) {
#ifdef __STDC__
--- 401,407 ----
}
break;
#endif
!
case 'n':
if (store) {
#ifdef __STDC__
***************
*** 348,414 ****
#else
p = (unsigned char *) *args;
#endif
! *((int *) p) = charcnt;
}
break;
!
case 'c': /* character data */
! width = wide1;
endnull = FALSE;
! delim[0] = '\0';
goto strproc;
!
case '[': /* string w/ delimiter set */
!
/* get delimiters */
! p = delim;
!
! if (*++fmt == '^')
fmt++;
! else
! lval = TRUE;
!
! rngflag = 2;
if ((*fmt == ']') || (*fmt == '-'))
{
! *p++ = *fmt++;
! rngflag = FALSE;
}
!
! while (*fmt != ']')
{
! if (*fmt == '\0')
! goto done;
! switch (rngflag)
! {
! case TRUE:
! c2 = *(p-2);
! if (c2 <= *fmt)
! {
! p -= 2;
! while (c2 < *fmt)
! *p++ = c2++;
! rngflag = 2;
! break;
! }
! /* fall thru intentional */
!
! case FALSE:
! rngflag = (*fmt == '-');
! break;
!
! case 2:
! rngflag = FALSE;
! }
!
! *p++ = *fmt++;
}
!
! *p = '\0';
goto strproc;
!
case 's': /* string data */
skip();
strproc:
/* process string */
#ifdef __STDC__
--- 409,472 ----
#else
p = (unsigned char *) *args;
#endif
! /* Compensate for lookahead */
! *((int *) p) = charcnt - 1;
}
break;
!
case 'c': /* character data */
! if (width == -1)
! width = 1;
endnull = FALSE;
! memset (delim, 0, sizeof (delim));
! if (c == EOF)
! goto done;
goto strproc;
!
case '[': /* string w/ delimiter set */
! endnull = TRUE;
!
/* get delimiters */
! neg = FALSE;
! if (*fmt == '^')
! {
fmt++;
! neg = TRUE;
! }
!
! memset (delim, !neg, sizeof (delim));
!
if ((*fmt == ']') || (*fmt == '-'))
{
! delim[*fmt++] = neg;
}
!
! while (c2 = *fmt++, c2 != ']')
{
! if (c2 == '\0')
! break;
! if (*fmt == '-' && fmt[1] && fmt[1] != ']')
! {
! while (c2 <= fmt[1])
! delim[c2++] = neg;
! fmt += 2;
! }
! else
! delim[c2] = neg;
}
!
goto strproc;
!
case 's': /* string data */
skip();
+ memset (delim, 0, sizeof (delim));
+ delim['\t'] = 1;
+ delim['\n'] = 1;
+ delim['\v'] = 1;
+ delim['\f'] = 1;
+ delim['\r'] = 1;
+ delim[' '] = 1;
+ endnull = TRUE;
strproc:
/* process string */
#ifdef __STDC__
***************
*** 417,430 ****
#else
p = ((unsigned char *) *args);
#endif
!
/* if the 1st char fails, match fails */
if (width)
{
! q = ((unsigned char *)
! strchr((const char *)delim, c));
! if((c < 1)
! || (lval ? (q == NULL) : (q != NULL)))
{
if (endnull)
if (store)
--- 475,485 ----
#else
p = ((unsigned char *) *args);
#endif
!
/* if the 1st char fails, match fails */
if (width)
{
! if (c == EOF || delim[c])
{
if (endnull)
if (store)
***************
*** 432,452 ****
goto done;
}
}
!
for (;;) /* FOREVER */
{
if (store)
*p++ = c;
charcnt++;
! if (((c = (*get)(ip)) < 1) ||
! (--width == 0))
break;
! q = ((unsigned char *)
! strchr((const char *)delim, c));
! if (lval ? (q == NULL) : (q != NULL))
break;
}
!
if (store)
{
if (endnull)
--- 487,505 ----
goto done;
}
}
!
for (;;) /* FOREVER */
{
if (store)
*p++ = c;
charcnt++;
! c = (*get)(ip);
! if (c == EOF || --width == 0)
break;
! if (delim[c])
break;
}
!
if (store)
{
if (endnull)
***************
*** 454,499 ****
++cnt;
}
break;
!
! case '\0': /* early EOS */
--fmt;
- /* FALL THRU */
-
- default:
goto cmatch;
}
}
else if (isspace(*fmt)) /* skip whitespace */
{
skip();
}
! else
{ /* normal match char */
cmatch:
! if (c != *fmt)
! break;
! if (fmt[1] == 0) { /* we're not going to have any more matches */
! return (cnt);
! }
charcnt++;
c = (*get)(ip);
}
!
#ifdef __STDC__
/* nothing to do */
#else
if (store)
args++;
#endif
-
- if (!*++fmt)
- break;
}
!
done: /* end of scan */
! if ((c < 0) && (cnt == 0))
return(EOF);
-
- (*unget)(c, ip);
return(cnt);
}
--- 507,547 ----
++cnt;
}
break;
!
! case '%':
--fmt;
goto cmatch;
+
+ default:
+ goto done;
}
}
else if (isspace(*fmt)) /* skip whitespace */
{
+ fmt++;
skip();
}
! else
{ /* normal match char */
cmatch:
! if (c != *fmt++)
! goto done;
charcnt++;
c = (*get)(ip);
}
!
#ifdef __STDC__
/* nothing to do */
#else
if (store)
args++;
#endif
}
!
done: /* end of scan */
! if (c != EOF)
! (*unget) (c, ip);
! if (c == EOF && cnt == 0)
return(EOF);
return(cnt);
}
*** 41.1 1993/11/03 13:33:02
--- spawn.c 1994/01/09 09:16:12
***************
*** 61,73 ****
static char *const extensions[] = { "ttp", "prg", "tos", NULL };
! static int interpret_script __PROTO((int mode, const char *path,
char *const *argv, char *const *envp));
static int
! interpret_script(mode, path, argv, envp)
int mode;
const char *path;
char *const *argv;
char *const *envp;
{
--- 61,74 ----
static char *const extensions[] = { "ttp", "prg", "tos", NULL };
! static int interpret_script __PROTO((int mode, const char *path, const char *,
char *const *argv, char *const *envp));
static int
! interpret_script(mode, path, _path, argv, envp)
int mode;
const char *path;
+ const char *_path;
char *const *argv;
char *const *envp;
{
***************
*** 140,146 ****
if (*shell)
{
! shell = buffindfile (shell, getenv("PATH"), extensions, tmppath);
if (!shell)
{
errno = ENOENT;
--- 141,147 ----
if (*shell)
{
! shell = _buffindfile (shell, getenv("PATH"), extensions, tmppath);
if (!shell)
{
errno = ENOENT;
***************
*** 164,171 ****
while (*shellargs++ != '\0');
}
! while (*argv != NULL)
! shellargv[i++] = *argv++;
shellargv[i] = NULL;
rv = _spawnve(mode, shell, shellargv, envp);
--- 165,174 ----
while (*shellargs++ != '\0');
}
! /* use the full pathname of the script instead of argv[0] */
! shellargv[i++] = (char *) _path;
! while (*++argv != NULL)
! shellargv[i++] = *argv;
shellargv[i] = NULL;
rv = _spawnve(mode, shell, shellargv, envp);
***************
*** 479,485 ****
if ((umode = getenv("UNIXMODE")) != NULL &&
strchr(umode, 's') != NULL ) {
(void)Mfree(env);
! return interpret_script(mode, path, _argv, _envp);
}
}
#endif
--- 482,488 ----
if ((umode = getenv("UNIXMODE")) != NULL &&
strchr(umode, 's') != NULL ) {
(void)Mfree(env);
! return interpret_script(mode, path, _path, _argv, _envp);
}
}
#endif
*** 41.1 1993/11/03 13:33:02
--- spawnvp.c 1994/01/09 09:16:14
***************
*** 25,31 ****
{
const char *execname;
char buffer[PATH_MAX];
! execname = buffindfile(name, getenv("PATH"), extensions,buffer);
if (!execname) {
errno = ENOENT;
return -1; /* file not found */
--- 25,31 ----
{
const char *execname;
char buffer[PATH_MAX];
! execname = _buffindfile(name, getenv("PATH"), extensions,buffer);
if (!execname) {
errno = ENOENT;
return -1; /* file not found */
*** 41.1 1993/11/03 13:33:02
--- sync.c 1994/01/09 09:52:10
***************
*** 11,19 ****
* minixfs V 060 PL 5 always syncs all drives, so there will
* be to much syncing, since we call Dcntl for all known drives.
*
! * $Revision: 41.1 $ $Date: 1993/11/03 13:33:02 $ $Author: root $
*
* $Log: sync.c,v $
* Revision 41.1 1993/11/03 13:33:02 root
* -
*
--- 11,25 ----
* minixfs V 060 PL 5 always syncs all drives, so there will
* be to much syncing, since we call Dcntl for all known drives.
*
! * $Revision: 41.2 $ $Date: 1994/01/09 09:52:04 $ $Author: schwab $
*
* $Log: sync.c,v $
+ * Revision 41.2 1994/01/09 09:52:04 schwab
+ * fsync() uses the value from st_dev in the stat structure to form a
+ * pathname for Dcntl. This value can be > 0x100 for filesystems mounted
+ * via FS_MOUNT. Currently there is no way to sync such a filesystem, i
+ * have changed fsync to just return successfully in this case.
+ *
* Revision 41.1 1993/11/03 13:33:02 root
* -
*
***************
*** 107,112 ****
--- 113,123 ----
if (fstat(fd, &statbuf))
return -1; /* errno set from fstat */
+
+ if (statbuf.st_dev >= 32)
+ /* If mounted via FS_MOUNT, st_dev will be > 0x100.
+ Pretend that it worked. */
+ return 0;
path[0] = 'A'+ statbuf.st_dev;
if (!Dcntl(MFS_VERIFY, path, &magic) && magic == MFS_MAGIC) {
*** 41.1 1993/11/03 13:33:02
--- tcattr.c 1993/11/24 21:08:30
***************
*** 72,78 ****
| ((sg.sg_flags & XKEY) ? IEXTEN : 0)
| ((sg.sg_flags & RAW)
? 0
! : ((sg.sg_flags & CBREAK) ? ISIG : ICANON)));
stp->_c_ispeed = (speed_t) sg.sg_ispeed;
stp->_c_ospeed = (speed_t) sg.sg_ospeed;
stp->c_cc[VEOF] = (cc_t) t.t_eofc;
--- 72,78 ----
| ((sg.sg_flags & XKEY) ? IEXTEN : 0)
| ((sg.sg_flags & RAW)
? 0
! : ISIG | (sg.sg_flags & CBREAK ? 0 : ICANON)));
stp->_c_ispeed = (speed_t) sg.sg_ispeed;
stp->_c_ospeed = (speed_t) sg.sg_ospeed;
stp->c_cc[VEOF] = (cc_t) t.t_eofc;
***************
*** 144,154 ****
}
sg.sg_flags |= ((stp->c_lflag & (TOSTOP | NOFLSH | ECHO))
| ((stp->c_lflag & IEXTEN) ? XKEY : 0)
! | ((stp->c_lflag & ICANON)
! ? 0
! : ((stp->c_lflag & ISIG) ? CBREAK : RAW)));
sg.sg_ispeed = (char) stp->_c_ispeed;
! sg.sg_ispeed = (char) stp->_c_ospeed;
t.t_eofc = (char) stp->c_cc[VEOF];
t.t_brkc = (char) stp->c_cc[VEOL];
sg.sg_erase = (char) stp->c_cc[VERASE];
--- 144,153 ----
}
sg.sg_flags |= ((stp->c_lflag & (TOSTOP | NOFLSH | ECHO))
| ((stp->c_lflag & IEXTEN) ? XKEY : 0)
! | ((stp->c_lflag & ISIG)
! ? (stp->c_lflag & ICANON ? 0 : CBREAK) : RAW));
sg.sg_ispeed = (char) stp->_c_ispeed;
! sg.sg_ospeed = (char) stp->_c_ospeed;
t.t_eofc = (char) stp->c_cc[VEOF];
t.t_brkc = (char) stp->c_cc[VEOL];
sg.sg_erase = (char) stp->c_cc[VERASE];
*** 41.1 1993/11/03 13:33:02
--- thread.c 1994/01/09 18:08:38
***************
*** 26,31 ****
--- 26,46 ----
#define SIZE 4096L
+ #ifdef __MBASE__ /* gcc -mbaserel data/bss base */
+ #define mbasep() \
+ ({ register long retvalue __asm__(__MBASESTR__); \
+ retvalue; \
+ })
+ #define fixmbasep(addr) (void) \
+ ({ \
+ __asm__ volatile \
+ (" movl %0,"__MBASESTR__ ";" \
+ : /* outputs */ \
+ : "g"(addr) /* inputs */ \
+ ); \
+ })
+ #endif /* __MBASE__ */
+
extern int __mint;
extern long _childtime; /* in main.c */
extern long _sigpending, _sigmask; /* in signal.c */
***************
*** 54,59 ****
--- 69,77 ----
_setstack( ((char *)b) + SIZE );
func = (int (*) __PROTO((long)))b->p_dbase;
arg = b->p_dlen;
+ #ifdef __MBASE__
+ fixmbasep((long) (b->p_bbase));
+ #endif /* __MBASE__ */
Pterm((*func)(arg));
}
***************
*** 78,83 ****
--- 96,104 ----
b->p_dbase = (char *)func;
b->p_dlen = arg;
b->p_hitpa = ((char *)b) + SIZE + 256;
+ #ifdef __MBASE__
+ b->p_bbase = (char *) mbasep();
+ #endif /* __MBASE__ */
if (__mint)
pid = Pexec(104, 0L, b, 0L);
***************
*** 95,102 ****
now = _clock();
pid = Pexec(4, 0L, b, 0L);
- (void)Mfree(b->p_env); /* free the memory */
- (void)Mfree(b);
_base = savbase;
/* restore signal stuff */
--- 116,121 ----
***************
*** 115,119 ****
--- 134,140 ----
_childtime += __waittime;
}
}
+ (void)Mfree(b->p_env); /* free the memory */
+ (void)Mfree(b);
return pid;
}
*** 41.1 1993/11/03 13:33:02
--- unx2dos.c 1994/01/09 09:44:22
***************
*** 171,180 ****
_unx2dos(buf, dos);
while (*dos)
dos++;
! *dos++ = ',';
}
! *--dos = 0;
return 0;
}
--- 171,181 ----
_unx2dos(buf, dos);
while (*dos)
dos++;
! if (*unx)
! *dos++ = ',';
}
! *dos = 0;
return 0;
}
***************
*** 198,206 ****
_dos2unx(buf, unx);
while (*unx)
unx++;
! *unx++ = ':';
}
! *--unx = 0;
return 0;
}
--- 199,208 ----
_dos2unx(buf, unx);
while (*unx)
unx++;
! if (*dos)
! *unx++ = ':';
}
! *unx = 0;
return 0;
}
*** 41.1 1993/11/04 03:12:46
--- crlf/crlf.c 1994/01/09 14:01:58
***************
*** 1,18 ****
! /* crlf.c 1.1 by entropy@terminator.rs.itd.umich.edu
PUBLIC DOMAIN -- NO RIGHTS RESERVED
NO WARRANTY -- USE AT YOUR OWN RISK!!!!!!!!!
strips/adds carriage returns from text files
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef __atarist__
#include <compiler.h>
#ifdef __TURBOC__
#include <sys\types.h>
#include <sys\stat.h>
#else /* not __TURBOC__ */
#include <sys/types.h>
#include <sys/stat.h>
--- 1,29 ----
! /* crlf.c 1.3 by entropy@terminator.rs.itd.umich.edu
!
PUBLIC DOMAIN -- NO RIGHTS RESERVED
NO WARRANTY -- USE AT YOUR OWN RISK!!!!!!!!!
strips/adds carriage returns from text files
*/
+ #ifndef __atarist__
+ #ifdef __TOS__ /* #defined by TurboC / PureC */
+ #define __atarist__
+ #endif
+ #endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
+ #include <time.h>
+ #include <utime.h>
+ #define UNUSED(x)
#ifdef __atarist__
#include <compiler.h>
#ifdef __TURBOC__
#include <sys\types.h>
#include <sys\stat.h>
+ #undef UNUSED
+ #define UNUSED(x) ((void)(x))
#else /* not __TURBOC__ */
#include <sys/types.h>
#include <sys/stat.h>
***************
*** 30,38 ****
#define EXIT_SUCCESS 0
#endif /* EXIT_SUCCESS */
#ifdef __STDC__
! #ifndef __NO_PROTO__
#define __PROTO(x) x
! #endif /* not __NO_PROTO__ */
#define __EXTERN
#else /* not __STDC__ */
#define __EXTERN extern
--- 41,49 ----
#define EXIT_SUCCESS 0
#endif /* EXIT_SUCCESS */
#ifdef __STDC__
! #ifndef __NO___PROTO__
#define __PROTO(x) x
! #endif /* not __NO___PROTO__ */
#define __EXTERN
#else /* not __STDC__ */
#define __EXTERN extern
***************
*** 40,47 ****
#endif /* not __STDC__ */
#endif /* not __atarist__ */
- __EXTERN int utime __PROTO((char *path, struct utimbuf *times));
-
extern char *optarg;
extern int optind, opterr;
--- 51,56 ----
***************
*** 50,63 ****
#define CR_NONE 2
char *program = NULL;
void perror2 __PROTO((char *msg1, char *msg2));
int crlf __PROTO((char *filename, int mode));
int simple_outchar __PROTO((FILE *ofp, int c));
int tounx_outchar __PROTO((FILE *ofp, int c));
int totos_outchar __PROTO((FILE *ofp, int c));
! int smart_copy __PROTO((char *ifn, char *ofn,
! int (*outcharfunc)(FILE *, int)));
void
perror2(msg1, msg2)
--- 59,73 ----
#define CR_NONE 2
char *program = NULL;
+ int verbose = 0;
void perror2 __PROTO((char *msg1, char *msg2));
int crlf __PROTO((char *filename, int mode));
int simple_outchar __PROTO((FILE *ofp, int c));
int tounx_outchar __PROTO((FILE *ofp, int c));
int totos_outchar __PROTO((FILE *ofp, int c));
! int smart_copy __PROTO((char *ifn, char *ofn,
! int (*outcharfunc)(FILE *, int)));
void
perror2(msg1, msg2)
***************
*** 86,91 ****
--- 96,103 ----
FILE *ofp;
int c;
{
+ if (c == '\r' ) /* first strip all CRs... */
+ return c;
if (c == '\n')
{
fputc('\r', ofp);
***************
*** 110,132 ****
smart_copy(ifn, ofn, outcharfunc)
char *ifn;
char *ofn;
! int (*outcharfunc)(FILE *, int);
{
FILE *ifp;
FILE *ofp;
int c;
! if ((ifp = fopen(ifn, "rb")) == NULL)
{
! perror2(program, ifn);
! return (-1);
}
! if ((ofp = fopen(ofn, "wb")) == NULL)
{
! fclose(ifp);
! perror2(program, ofn);
! return (-1);
}
c = fgetc(ifp);
while (!(feof(ifp)) && !(ferror(ifp)) && !(ferror(ofp)))
{
--- 122,160 ----
smart_copy(ifn, ofn, outcharfunc)
char *ifn;
char *ofn;
! int (*outcharfunc) __PROTO((FILE *, int));
{
FILE *ifp;
FILE *ofp;
int c;
! if (*ifn)
{
! if ((ifp = fopen(ifn, "rb")) == NULL)
! {
! perror2(program, ifn);
! return (-1);
! }
}
! else
{
! ifp = stdin;
! }
! if (*ofn)
! {
! if ((ofp = fopen(ofn, "wb")) == NULL)
! {
! fclose(ifp);
! perror2(program, ofn);
! return (-1);
! }
}
+ else
+ {
+ ofp = stdout;
+ }
+ setvbuf(ofp, NULL, _IOFBF, 50*1024L);
+ setvbuf(ifp, NULL, _IOFBF, 50*1024L);
c = fgetc(ifp);
while (!(feof(ifp)) && !(ferror(ifp)) && !(ferror(ofp)))
{
***************
*** 136,159 ****
if (ferror(ifp))
{
perror2(program, ifn);
! fclose(ifp);
! fclose(ofp);
return (-1);
}
if (ferror(ofp))
{
perror2(program, ofn);
! fclose(ifp);
! fclose(ofp);
return (-1);
}
! if (fclose(ifp) == EOF)
{
perror2(program, ifn);
! fclose(ofp);
return (-1);
}
! if (fclose(ofp) == EOF)
{
perror2(program, ofn);
return (-1);
--- 164,202 ----
if (ferror(ifp))
{
perror2(program, ifn);
! if (*ifn)
! {
! fclose(ifp);
! }
! if (*ofn)
! {
! fclose(ofp);
! }
return (-1);
}
if (ferror(ofp))
{
perror2(program, ofn);
! if (*ifn)
! {
! fclose(ifp);
! }
! if (*ofn)
! {
! fclose(ofp);
! }
return (-1);
}
! if (*ifn && fclose(ifp) == EOF)
{
perror2(program, ifn);
! if (*ofn)
! {
! fclose(ofp);
! }
return (-1);
}
! if (*ofn && fclose(ofp) == EOF)
{
perror2(program, ofn);
return (-1);
***************
*** 166,181 ****
char *filename;
int mode; /* 0 == strip CR's, 1 == add CR's */
{
! char tempname[256];
! int (*outcharfunc)(FILE *, int);
- strcpy(tempname, "/tmp/crlfXXXXXX");
- if (mktemp(tempname) == NULL)
- {
- fputs(program, stderr);
- fputs(": could not get a temporary filename\n", stderr);
- return (-1);
- }
switch (mode)
{
case CR_ADD:
--- 209,218 ----
char *filename;
int mode; /* 0 == strip CR's, 1 == add CR's */
{
! char tempname[FILENAME_MAX];
! char *ev;
! int (*outcharfunc) __PROTO((FILE *, int));
switch (mode)
{
case CR_ADD:
***************
*** 186,204 ****
outcharfunc = tounx_outchar;
break;
}
! if (smart_copy(filename, tempname, outcharfunc))
{
! return (-1);
}
! if (rename(tempname, filename))
{
! if (smart_copy(tempname, filename, simple_outchar))
{
return (-1);
}
! if (unlink(tempname))
{
- perror2(program, tempname);
return (-1);
}
}
--- 223,270 ----
outcharfunc = tounx_outchar;
break;
}
! if (verbose)
{
! fputs(filename, stderr);
! fputc('\n', stderr);
}
! if (*filename)
{
! *tempname = '\0';
! if ((ev = getenv("TEMP")) || (ev = getenv("TMP"))
! || (ev = getenv("TMPDIR")))
! {
! strcpy(tempname, ev);
! strcat(tempname, "/");
! }
! strcat(tempname, "crlfXXXX");
! if (mktemp(tempname) == NULL)
{
+ fputs(program, stderr);
+ fputs(": could not get a temporary filename\n", stderr);
return (-1);
}
! if (smart_copy(filename, tempname, outcharfunc))
! {
! return (-1);
! }
! if (rename(tempname, filename))
! {
! if (smart_copy(tempname, filename, simple_outchar))
! {
! return (-1);
! }
! if (unlink(tempname))
! {
! perror2(program, tempname);
! return (-1);
! }
! }
! }
! else
! {
! if (smart_copy("", "", outcharfunc))
{
return (-1);
}
}
***************
*** 214,222 ****
int err = 0;
struct stat st;
struct utimbuf ut;
!
program = argv[0];
! while ((c = getopt(argc, argv, "as")) != EOF)
{
switch (c)
{
--- 280,289 ----
int err = 0;
struct stat st;
struct utimbuf ut;
!
! UNUSED(envp);
program = argv[0];
! while ((c = getopt(argc, argv, "asv")) != EOF)
{
switch (c)
{
***************
*** 224,230 ****
if (mode == CR_NONE)
{
mode = CR_ADD;
! }
else
{
err++;
--- 291,297 ----
if (mode == CR_NONE)
{
mode = CR_ADD;
! }
else
{
err++;
***************
*** 234,245 ****
if (mode == CR_NONE)
{
mode = CR_STRIP;
! }
else
{
err++;
}
break;
case '?':
default:
err++;
--- 301,315 ----
if (mode == CR_NONE)
{
mode = CR_STRIP;
! }
else
{
err++;
}
break;
+ case 'v':
+ verbose = 1;
+ break;
case '?':
default:
err++;
***************
*** 250,290 ****
{
err++;
}
! if (err || (optind >= argc))
{
fputs("usage: ", stderr);
fputs(program, stderr);
! fputs(" -s file [file2 [...]] (to strip carriage returns)\n", stderr);
fputs(" ", stderr);
fputs(program, stderr);
! fputs(" -a file [file2 [...]] (to add carriage returns)\n", stderr);
exit(EXIT_FAILURE);
}
! for ( ; optind < argc; optind++)
{
! fn = argv[optind];
! if (access(fn, 4))
{
err++;
- perror2(program, fn);
- continue;
}
! if (stat(fn, &st))
! {
! err++;
! perror2(program, fn);
! }
! ut.actime = st.st_atime;
! ut.modtime = st.st_mtime;
! if (crlf(fn, mode) != 0)
! {
! err++;
! continue;
! }
! if (utime(fn, &ut))
{
! err++;
! perror2(program, fn);
}
}
if (err)
--- 320,380 ----
{
err++;
}
! if (err)
{
fputs("usage: ", stderr);
fputs(program, stderr);
! fputs(" -s[v] [file [file2 [...]]] (to strip carriage returns)\n", stderr);
fputs(" ", stderr);
fputs(program, stderr);
! fputs(" -a[v] [file [file2 [...]]] (to add carriage returns)\n", stderr);
exit(EXIT_FAILURE);
}
! if (optind == argc)
{
! if (crlf("", mode) != 0)
{
err++;
}
! }
! else
! {
! for ( ; optind < argc; optind++)
{
! fn = argv[optind];
! if (access(fn, 4))
! {
! err++;
! perror2(program, fn);
! continue;
! }
! if (stat(fn, &st))
! {
! err++;
! perror2(program, fn);
! }
! if (!(S_ISREG(st.st_mode)))
! {
! if (verbose)
! {
! fputs("crlf: ignoring non-regular file ", stderr);
! fputs(fn, stderr);
! fputc('\n', stdout);
! }
! continue;
! }
! ut.actime = st.st_atime;
! ut.modtime = st.st_mtime;
! if (crlf(fn, mode) != 0)
! {
! err++;
! continue;
! }
! if (utime(fn, &ut))
! {
! err++;
! perror2(program, fn);
! }
}
}
if (err)
*** 41.1 1993/11/04 03:12:46
--- crlf/crlf.doc 1994/01/09 14:40:08
***************
*** 1,8 ****
crlf.c by entropy@terminator.rs.itd.umich.edu
PUBLIC DOMAIN -- NO RIGHTS RESERVED
! usage: crlf -s file [file2 [...]] (to strip carriage returns)
! crlf -a file [file2 [...]] (to add carriage returns)
crlf converts text files between TOS (MS-DOS) and UNIX style line
terminators.
--- 1,9 ----
crlf.c by entropy@terminator.rs.itd.umich.edu
+
PUBLIC DOMAIN -- NO RIGHTS RESERVED
! usage: crlf -s [file [...]] (to strip carriage returns)
! crlf -a [file [...]] (to add carriage returns)
crlf converts text files between TOS (MS-DOS) and UNIX style line
terminators.
***************
*** 13,19 ****
file. Be careful that you do not run this twice on the same file (or at all
on a file that already has carriage returns) as you will end up with really
strange line terminators that way (recover by stripping and re-adding
! returns.
If any errors/warnings occur while trying to convert a file, an error status
will be returned to the OS when the program exits. If you are running from
--- 14,23 ----
file. Be careful that you do not run this twice on the same file (or at all
on a file that already has carriage returns) as you will end up with really
strange line terminators that way (recover by stripping and re-adding
! returns).
!
! If no file is specified the input is read from `stdin' and put to `stdout'.
! So you can use it as filter in a pipe.
If any errors/warnings occur while trying to convert a file, an error status
will be returned to the OS when the program exits. If you are running from
Binary files /tmp/T0273000 and crlf/crlf.ttp differ
*** 41.1 1993/11/04 03:12:46
--- crlf/makefile 1994/01/09 13:48:14
***************
*** 9,17 ****
.SUFFIXES: .ttp .tos .prg .sym
- .o.ttp:
- $(CC) $(LDFLAGS) $< -o $@ $(LIBS)
-
#
#
all: crlf.ttp
--- 9,14 ----
***************
*** 19,24 ****
--- 16,22 ----
#
#
crlf.ttp: crlf.o
+ $(CC) $(LDFLAGS) $< -o $@ $(LIBS)
crlf.o: crlf.c
#
*** /dev/null Sun Jan 16 05:00:22 1994
--- purec/unixname/unixname.s Wed Nov 3 22:20:38 1993
***************
*** 0 ****
--- 1,113 ----
+ ;{{{}}}
+ ;{{{ about this file
+ ; Author: Michael Schwingen
+ ; Kranichstraße 10
+ ; 5042 Erftstadt
+ ; purpose:
+ ; Unixname installes itself resident in the GEMDOS trap vector and converts
+ ; all '/'s in filenames to TOS-like '\'.
+ ; Assembler: DevpacST 2.0
+ ;}}}
+ ;{{{ List of GEMDOS-functions and address of filename on stack
+ ; 57 (Dcreate) : 8(SP)
+ ; 58 (Ddelete) : 8(SP)
+ ; 59 (Dsetpath) : 8(SP)
+ ; 60 (Fcreate) : 8(SP)
+ ; 61 (Fopen) : 8(SP)
+ ; 65 (Fdelete) : 8(SP)
+ ; 67 (Fattrib) : 8(SP)
+ ; 75 (Pexec) : 10(SP) - 8(SP) = mode, changes only if 0/3 !
+ ; 78 (Fsfirst) : 8(SP)
+ ; 86 (Frename) : 10(SP),14(SP)
+ ;}}}
+
+ opt o+
+
+ start: bra init
+
+ ;{{{ new trap#1 handler
+ DC.B "XBRAUn*x"
+ oldvec: DC.L 0
+ new_vec: move.w (sp),d0 ; get SR
+ lea 6(sp),a0
+ btst #$0D,d0 ; SUPER-mode ?
+ bne.s .new2 ; yes
+ move usp,a0 ; no, parameters are on userstack
+ .new2: move.w (a0),d0 ; get GEMDOS Opcode
+ cmp.w #57,d0 ; Dcreate() ?
+ beq func_type1
+ cmp.w #58,d0 ; Ddelete() ?
+ beq func_type1
+ cmp.w #59,d0 ; Dsetpath() ?
+ beq func_type1
+ cmp.w #60,d0 ; Fcreate() ?
+ beq func_type1
+ cmp.w #61,d0 ; Fopen() ?
+ beq func_type1
+ cmp.w #65,d0 ; Fdelete() ?
+ beq func_type1
+ cmp.w #67,d0 ; Fattrib() ?
+ beq func_type1
+ cmp.w #75,d0 ; Pexec() ?
+ beq func_pexec
+ cmp.w #78,d0 ; Fsfirst() ?
+ beq func_type1
+ cmp.w #86,d0 ; Frename() ?
+ beq func_frename
+ old_vec: movea.l oldvec,a0
+ jmp (a0)
+ func_type1: movea.l 2(a0),a0 ; ptr to filename
+ func1_1: bsr convert_name
+ bra.s old_vec
+ func_pexec: move.w 2(a0),d0 ; mode: 0/3 = filename at 4(a0)
+ cmp.w #0,d0
+ beq.s .pexec2
+ cmp.w #3,d0
+ bne.s old_vec
+ .pexec2: movea.l 4(a0),a0
+ bra.s func1_1
+ func_frename: move.l a0,-(sp)
+ movea.l 8(a0),a0
+ bsr convert_name
+ movea.l (sp)+,a0
+ bra.s func_pexec
+ ;}}}
+ ;{{{ convert_name: convert '/' -> '\' at (a0)+
+ convert_name:
+ move.b (a0),d0
+ beq .convend
+ cmp.b #"/",d0
+ bne .convnext
+ move.b #"\",(a0)
+ .convnext: addq.l #1,a0
+ bra.s convert_name
+ .convend: rts
+ ;}}}
+
+ res_len EQU *-start
+ ; everything after this point does not stay resident in memory
+
+ ;{{{ install resident part
+ init: pea new_vec(pc)
+ move.l #$050021,-(sp) ; Setexc(33,...)
+ trap #13
+ addq.l #8,sp
+ move.l d0,oldvec
+
+ lea inst_txt(pc),a0
+ bsr Cconws
+
+ clr.w -(sp) ; Ret.-Code
+ move.l #256+res_len,-(sp)
+ move.w #49,-(sp) ; Ptermres()
+ trap #1
+ ;}}}
+ ;{{{ Cconws: print text
+ Cconws: move.l a0,-(sp)
+ move.w #9,-(sp)
+ trap #1 ; Cconws
+ addq.l #6,sp
+ rts
+ ;}}}
+
+ inst_txt: DC.B 13,10,"Un*xName V1.0 © 1991 by Michael Schwingen installed.",13,10,0
Binary files /dev/null and purec/unixname/unixname.tos differ
*** /dev/null Sun Jan 16 05:00:42 1994
--- purec/unixname/unixname.txt Wed Nov 3 22:20:40 1993
***************
*** 0 ****
--- 1,49 ----
+ UNIXNAME V1.0
+ -------------
+ Unixname is a little utility which installes itself in the GEMDOS trap
+ vector. It then monitors all file functions and watches if filenames contain
+ '/'. If a '/' is found, it is then converted into a '\'. This is especially
+ useful when porting Un*x-software which does things like '#include
+ <local/argparse.h>' - you don't have to change it in the sources.
+ If a program does something like 'fh = open("bind/test")', this will work
+ while Unixname is installed - so remember to change this because otherwise
+ every user would need Unixname to run that program.
+
+ Unixname watches the following GEMDOS functions:
+ 57 (Dcreate)
+ 58 (Ddelete)
+ 59 (Dsetpath)
+ 60 (Fcreate)
+ 61 (Fopen)
+ 65 (Fdelete)
+ 67 (Fattrib)
+ 75 (Pexec)
+ 78 (Fsfirst)
+ 86 (Frename)
+
+ Unixname is distributed in source and binary form. The program and code is
+ copyrighted, but may be freely distributed under the following conditions:
+ - The source code must be available along with the binaries. The binaries
+ may be omitted. This documentation must always be copied in an unmodified
+ form.
+ - Modified versions must be clearly marked as such. The copyright note and
+ my name may not me removed from source or binaries. I would appreciate if
+ you send me a copy of modified versions.
+ - No charge may be made other than a reasonable charge for reproduction.
+ - I am not responsible for any consequences resulting from the use or the
+ inability to use this software, even if they result from defects in it.
+ - The program may be distributed together with commercial programs if both
+ source and binaries are distributed and if is made clear that this program
+ is public domain.
+
+ You can make as many copies of this programs as you wish. Give it to friends,
+ distribute it via networks or do whatever you want to do with it.
+
+ If you have any problems with this program, feel free to contact me:
+
+ Michael Schwingen
+ Ahornstrasse 36
+ W-5100 Aachen
+ Germany
+ Internet: michaels@messua.informatik.rwth-aachen.de
+